AggressiveSplittingPlugin in conjunction with ExtractTextPlugin throws conflict error if a module from node_modules is required

I forked the extract-text-plugin to make the failing test.

After adding AggressiveSplittingPlugin on top of example folder and then installing bootstrap and requiring it in entry.js I am getting following error in webpack output:

Child extract-text-webpack-plugin:
        + 7 hidden modules

    ERROR in chunk 1 [initial]
    extract-text-webpack-plugin-output-filename
    Conflict: Multiple assets emit to the same filename 'extract-text-webpack-plugin-output-filename'

Full output:

example $ ../node_modules/.bin/webpack                                                                   
Hash: 988283afb66ea06041c5
Version: webpack 2.2.0-rc.0
Time: 1660ms
                                                                                     Asset       Size  Chunks             Chunk Names
    css/a.css?988283afb66ea06041c5-fbbf0bdca6466cd7054b-0e8f1e1a6a196bd8d3016b5472ec5402-a  471 bytes  1  [emitted]  a
                                                      ce21cbdd9b894e6af794813eb3fdaf60.png  119 bytes     [emitted]
                                                      89889688147bd7575d6327160d64e760.svg     109 kB     [emitted]
                                                      e18bbf611f2a2e43afc071aa2f4e1512.ttf    45.4 kB     [emitted]
                                                     fa2772327f55d8198301fdb8bcfc8158.woff    23.4 kB     [emitted]
                                                    448c34a56d699c29117adc64c43affeb.woff2      18 kB     [emitted]
                                            0.js?988283afb66ea06041c5-834f07865d1c491436dd  294 bytes  0  [emitted]
                                            a.js?988283afb66ea06041c5-fbbf0bdca6466cd7054b       2 kB  1  [emitted]  a
                                            b.js?988283afb66ea06041c5-2db2c8ad447515a9cc35  607 bytes  2  [emitted]  b
                                                                                      c.js    5.99 kB  3  [emitted]  c
                                                      f4769f9bdb7466be65088239c12046d1.eot    20.1 kB     [emitted]
    css/b.css?988283afb66ea06041c5-2db2c8ad447515a9cc35-2110e8350d956e70f32921d039c4df6c-b  462 bytes  2  [emitted]  b
    css/c.css?988283afb66ea06041c5-4c4db3fd37fddc31875f-03632cea419e690906a6b736af964e66-c  186 bytes  3  [emitted]  c
                                        0.js.map?988283afb66ea06041c5-834f07865d1c491436dd  488 bytes  0  [emitted]
                                        a.js.map?988283afb66ea06041c5-fbbf0bdca6466cd7054b  976 bytes  1  [emitted]  a
css/a.css.map?988283afb66ea06041c5-fbbf0bdca6466cd7054b-0e8f1e1a6a196bd8d3016b5472ec5402-a    1.05 kB  1  [emitted]  a
                                        b.js.map?988283afb66ea06041c5-2db2c8ad447515a9cc35  958 bytes  2  [emitted]  b
css/b.css.map?988283afb66ea06041c5-2db2c8ad447515a9cc35-2110e8350d956e70f32921d039c4df6c-b    1.33 kB  2  [emitted]  b
                                                                                  c.js.map    6.19 kB  3  [emitted]  c
css/c.css.map?988283afb66ea06041c5-4c4db3fd37fddc31875f-03632cea419e690906a6b736af964e66-c  379 bytes  3  [emitted]  c
   [0] ./common.css 41 bytes {3} [built]
   [1] ./dep.js 45 bytes {1} [built]
   [2] ./style.css 41 bytes {1} [built]
   [3] ./style4.css 41 bytes {2} [built]
   [4] ./style5.css 41 bytes {2} [built]
   [5] ./style6.css 41 bytes {2} [built]
   [7] ./style2.css 41 bytes {1} [built]
   [8] ./entry.js 112 bytes {1} [built]
   [9] ./entry2.js 100 bytes {2} [built]
  [10] ./dep2.js 24 bytes {0} [built]
  [11] ./style3.css 41 bytes {0} [built]
    + 1 hidden modules

ERROR in ../~/bootstrap/dist/css/bootstrap.css
Module build failed: ChunkRenderError: Conflict: Multiple assets emit to the same filename 'extract-text-webpack-plugin-output-filename'
    at Compilation.createChunkAssets (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:1073:21)
    at sealPart2 (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:599:9)
    at Compilation.applyPluginsAsyncSeries (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/tapable/lib/Tapable.js:95:46)
    at Compilation.seal (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:552:7)
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compiler.js:473:16
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/tapable/lib/Tapable.js:189:11
    at Compilation.<anonymous> (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:454:10)
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:425:12
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

ERROR in ../~/bootstrap/dist/css/bootstrap.css
Module build failed: ChunkRenderError: Conflict: Multiple assets emit to the same filename 'extract-text-webpack-plugin-output-filename'
    at Compilation.createChunkAssets (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:1073:21)
    at sealPart2 (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:599:9)
    at Compilation.applyPluginsAsyncSeries (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/tapable/lib/Tapable.js:95:46)
    at Compilation.seal (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:552:7)
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compiler.js:473:16
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/tapable/lib/Tapable.js:189:11
    at Compilation.<anonymous> (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:454:10)
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:425:12
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

ERROR in ../~/bootstrap/dist/css/bootstrap.css
Module build failed: ChunkRenderError: Conflict: Multiple assets emit to the same filename 'extract-text-webpack-plugin-output-filename'
    at Compilation.createChunkAssets (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:1073:21)
    at sealPart2 (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:599:9)
    at Compilation.applyPluginsAsyncSeries (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/tapable/lib/Tapable.js:95:46)
    at Compilation.seal (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:552:7)
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compiler.js:473:16
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/tapable/lib/Tapable.js:189:11
    at Compilation.<anonymous> (/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:454:10)
    at /Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/webpack/lib/Compilation.js:425:12
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

ERROR in /Users/mazimi/Desktop/extract-text-webpack-plugin/loader.js?{"omit":0,"remove":true,"notExtractLoader":"style-loader","publicPath":"../"}!/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/css-loader/index.js?sourceMap!/Users/mazimi/Desktop/extract-text-webpack-plugin/node_modules/bootstrap/dist/css/bootstrap.css doesn't export content
Child extract-text-webpack-plugin:
       [1] ../~/css-loader?sourceMap!./common.css 519 bytes {0} [built]
        + 1 hidden modules
Child extract-text-webpack-plugin:
       [1] ../~/css-loader?sourceMap!./style6.css 395 bytes {0} [built]
        + 1 hidden modules
Child extract-text-webpack-plugin:
       [1] ../~/css-loader?sourceMap!./style5.1.css 399 bytes {0} [built]
       [2] ../~/css-loader?sourceMap!./style5.2.css 399 bytes {0} [built]
       [3] ../~/css-loader?sourceMap!./style5.css 632 bytes {0} [built]
        + 1 hidden modules
Child extract-text-webpack-plugin:
       [1] ../~/css-loader?sourceMap!./base.css 671 bytes {0} [built]
       [2] ./image.png 82 bytes {0} [built]
       [3] ../~/css-loader?sourceMap!./style4.css 603 bytes {0} [built]
        + 1 hidden modules
Child extract-text-webpack-plugin:
       [1] ../~/css-loader?sourceMap!./base.css 671 bytes {0} [built]
       [2] ./image.png 82 bytes {0} [built]
       [3] ../~/css-loader?sourceMap!./style.css 563 bytes {0} [built]
        + 1 hidden modules
Child extract-text-webpack-plugin:
       [1] ./image.png 82 bytes {0} [built]
       [2] ../~/css-loader?sourceMap!./style3.css 561 bytes {0} [built]
        + 1 hidden modules
Child extract-text-webpack-plugin:
                                   Asset       Size  Chunks           Chunk Names
    ce21cbdd9b894e6af794813eb3fdaf60.png  119 bytes  [emitted]
       [1] ../~/css-loader?sourceMap!./base.css 671 bytes {0} [built]
       [2] ../~/css-loader?sourceMap!./style3.css 561 bytes {0} [built]
       [3] ./image.png 82 bytes {0} [built]
       [4] ../~/css-loader?sourceMap!./style2.css 624 bytes {0} [built]
        + 1 hidden modules
Child extract-text-webpack-plugin:
        + 7 hidden modules

    ERROR in chunk 1 [initial]
    extract-text-webpack-plugin-output-filename
    Conflict: Multiple assets emit to the same filename 'extract-text-webpack-plugin-output-filename'
Child extract-text-webpack-plugin:
                                     Asset     Size  Chunks           Chunk Names
      f4769f9bdb7466be65088239c12046d1.eot  20.1 kB  [emitted]
      89889688147bd7575d6327160d64e760.svg   109 kB  [emitted]
      e18bbf611f2a2e43afc071aa2f4e1512.ttf  45.4 kB  [emitted]
     fa2772327f55d8198301fdb8bcfc8158.woff  23.4 kB  [emitted]
    448c34a56d699c29117adc64c43affeb.woff2    18 kB  [emitted]
        + 7 hidden modules

    ERROR in chunk 1 [initial]
    extract-text-webpack-plugin-output-filename
    Conflict: Multiple assets emit to the same filename 'extract-text-webpack-plugin-output-filename'

webpack.config.js

var webpack = require("webpack");
var path = require("path");
var ExtractTextPlugin = require("../");
module.exports = {
	entry: {
		a: "./entry.js",
		b: "./entry2.js"
	},
	output: {
		filename: "[name].js?[hash]-[chunkhash]",
		chunkFilename: "[name].js?[hash]-[chunkhash]",
		path: __dirname + "/assets",
		publicPath: "/assets/"
	},
	module: {
		loaders: [
			{ test: /\.css$/, loader: ExtractTextPlugin.extract({
				notExtractLoader: "style-loader",
				loader: "css-loader?sourceMap",
				publicPath: "../"
			}) },
			{ test: /\.(png|eot|woff|woff2|ttf|svg)$/, loader: "file-loader" }
		]
	},
	devtool: "source-map",
	recordsOutputPath: path.join(__dirname, "js", "records.json"),
	plugins: [
		new ExtractTextPlugin({
			filename: "css/[name].css?[hash]-[chunkhash]-[contenthash]-[name]",
			disable: false,
			allChunks: true
		}),
		new webpack.optimize.CommonsChunkPlugin({ name: "c", filename: "c.js" }),
		new webpack.optimize.AggressiveSplittingPlugin({
			minSize: 30000,
            maxSize: 50000
		}),
		new webpack.DefinePlugin({
            "process.env.NODE_ENV": JSON.stringify("production")
        })
	]
};

Author: Fantashit

1 thought on “AggressiveSplittingPlugin in conjunction with ExtractTextPlugin throws conflict error if a module from node_modules is required

  1. @mohsen1 Im sorry..but I think this is actually webpack’s duty to correct this obstacle…

    This issue is present in both html-webpack-plugin & extract-text-webpack-plugin. It is a blocker for any plugin that needs to output to the same file. That is a bug that only AggressiveSplittingPlugin can solve.

    I believe AggressiveSplittingPlugin needs a “ignoreAssets” option… or something that doesn’t cause an exception when a plugin is sharing those same lifecycle hooks.

Comments are closed.