Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path')
- const { CleanWebpackPlugin: CleanPlugin } = require('clean-webpack-plugin')
- const LoadablePlugin = require('@loadable/webpack-plugin')
- const NODE_ENV = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'
- function isProduction() {
- return NODE_ENV === 'production'
- }
- const cssLoader = {
- loader: 'css-loader',
- options: {
- modules: {
- mode: 'local',
- localIdentName: isProduction() ? '[contenthash:8]' : '[name]-[contenthash:8]'
- }
- }
- }
- module.exports = {
- entry: {
- app: path.resolve(__dirname, 'src', 'index.ts')
- },
- output: {
- filename: '[name].js',
- chunkFilename: '[chunkhash].js',
- path: path.resolve(__dirname, '../', 'dist', 'client'),
- publicPath: '/dist/'
- },
- devtools: false,
- target: 'node',
- resolve: {
- extensions: [
- '.styl',
- '.tsx',
- '.ts',
- '.jsx',
- '.js'
- ]
- },
- module: {
- rules: [
- {
- test: /\.tsx?$/,
- exclude: /node_modules/,
- use: [
- 'babel-loader',
- 'ts-loader'
- ]
- },
- {
- test: /\.jsx?$/,
- exclude: /node_modules/,
- use: [
- 'babel-loader'
- ]
- },
- {
- test: /\.css$/,
- use: [
- 'null-loader',
- cssLoader
- ]
- },
- {
- test: /\.styl$/,
- use: [
- 'null-loader',
- cssLoader,
- 'stylus-loader'
- ]
- }
- ]
- },
- plugins: [
- new CleanPlugin(),
- new LoadablePlugin()
- ],
- stats: {
- children: false
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement