easy-webpack / config-css

MIT License
0 stars 2 forks source link

config-css module broken. #3

Closed marcusalmeida closed 8 years ago

marcusalmeida commented 8 years ago

I tried to execute the Aurelia Skeleton command npm start , but receive the message below.

Analyzing the stacktrace I saw that has a problem with config-css module.

The constructor used on https://github.com/easy-webpack/config-css/blob/master/src/index.ts#L33 is not ok with the version 2.0.0-beta-2 from "extract-text-webpack-plugin", used on easy-webpack, on https://github.com/webpack/extract-text-webpack-plugin/blob/master/index.js#L106.

The constructor on extract-text-webpack-plugin receive an object with options and not a list of parameters like in config-css.

/my-workspace/skeleton-esnext-webpack/node_modules/@easy-webpack/config-css/node_modules/extract-text-webpack-plugin/index.js:108 throw new Error("Breaking change: ExtractTextPlugin now only takes a single argument. Either an options " + ^

Error: Breaking change: ExtractTextPlugin now only takes a single argument. Either an options object or the name of the result file. Example: if your old code looked like this: new ExtractTextPlugin('css/[name].css', { disable: false, allChunks: true })

You would change it to: new ExtractTextPlugin({ filename: 'css/[name].css', disable: false, allChunks: true })

The available options are: filename: string allChunks: boolean disable: boolean

at new ExtractTextPlugin (/home/marcus/sandbox/javascript/webpack/skeleton-esnext-webpack/node_modules/@easy-webpack/config-css/node_modules/extract-text-webpack-plugin/index.js:108:9)
at Object.css (/home/marcus/sandbox/javascript/webpack/skeleton-esnext-webpack/node_modules/@easy-webpack/config-css/dist/index.js:22:35)
at generateConfig (/home/marcus/sandbox/javascript/webpack/skeleton-esnext-webpack/node_modules/@easy-webpack/core/dist/index.js:28:46)
at Object.<anonymous> (/home/marcus/sandbox/javascript/webpack/skeleton-esnext-webpack/webpack.config.js:127:14)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at module.exports (/home/marcus/sandbox/javascript/webpack/skeleton-esnext-webpack/node_modules/webpack/bin/convert-argv.js:93:13)
at Object.<anonymous> (/home/marcus/sandbox/javascript/webpack/skeleton-esnext-webpack/node_modules/webpack-dev-server/bin/webpack-dev-server.js:121:48)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
lihtness commented 8 years ago

Suggested change to fix.

Replace line 33 with, extractText = new ExtractTextPlugin(Object.assign({}, {filename}, extractText instanceof Object ? extractText : { allChunks: allChunks, sourceMap: sourceMap }));

To make it work till the fix is in, update @easy-webpack/config-css/dist/index.js @line 22 with the same line.

niieani commented 8 years ago

Seems like ExtractTextPlugin has been undergoing some heavy changes in the last 12 hours; I've just updated the problematic package to the new syntax. Alternatively you can get around the issue by passing extractText: false to config-css.