Answer the question
In order to leave comments, you need to log in
How to create but NOT include chunks in Webpack 4?
Hey,
/* eslint-disable import/no-extraneous-dependencies */
import { DefinePlugin } from 'webpack';
import Config from 'webpack-config';
import Path from 'path';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import CleanWebpackPlugin from 'clean-webpack-plugin';
import Autoprefixer from 'autoprefixer';
const appPath = Path.resolve(__dirname, 'app/js');
const stylesPath = Path.resolve(__dirname, 'app/stylus');
export default new Config().extend('webpack.base.babel.js').merge({
entry: appPath,
output: {
filename: 'js/ame.bundle.js',
chunkFilename: 'js/[name].bundle.js',
path: Path.resolve(__dirname, 'build'),
publicPath: '/',
},
module: {
rules: [
{
test: /\.styl$/,
include: [stylesPath, appPath],
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: 'postcss-loader',
options: {
plugins: () => [Autoprefixer],
},
},
{
loader: 'stylus-loader',
},
]
}),
},
],
},
plugins: [
new DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new ExtractTextPlugin({
filename: 'css/ame.bundle.css',
}),
new CleanWebpackPlugin(['build'], {
root: Path.resolve(__dirname),
verbose: true,
dry: false,
}),
],
});
var a=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.async=!0,s.timeout=12e4,e.nc&&s.setAttribute("nonce",e.nc),s.src=e.p+"js/"+({0:"angular-modules"}[t]||t)+".bundle.js";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question