S
S
Seva2019-09-18 15:12:30
JavaScript
Seva, 2019-09-18 15:12:30

How to create but NOT include chunks in Webpack 4?

Hey,

webpack config
/* 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,
    }),


  ],
});

After the build, the following appears in ame.bundle.js:
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";

This is unnecessary behavior, I do not need to include chunks in head - they are deployed to AWS and loaded from there. There is no HtmlWebpackPlugin in the project at all, for the second day I cannot understand what the hell is going on.
Any ideas?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question