For some reason, this configuration fails when trying to build using extract-text-webpack-plugin. I tried to work with extract-text-webpack-plugin for several days and I had a lot of problems trying to output css. I feel that I configured it correctly after looking through many manuals and looking at many questions, but maybe I am missing something.
webpack.config.js
var entry_object = {}; entry_object[build_js_dir + "file.js"] = static_js + 'file.js'; entry: entry_object, output: { path: './', filename: '[name]', chunkFileName: "[id].chunk.js" }, module: { loaders: [{ test: /\.js$/, include: path.resolve(__dirname), exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['react', 'es2015'] } }, { test: /\.scss$/, loader: ExtractTextPlugin.extract("css-loader!sass-loader") } ]} plugins: [ new ExtractTextPlugin("[name].css"), ] }
Error Details:
~/src/$ webpack --show-error-details Hash: ab317ccc65911901bea4 Version: webpack 1.13.0 Time: 1032ms Asset Size Chunks Chunk Names ./static/build/js/file.js 51.7 kB 0 [emitted] ./static/build/js/file.js [1] ./static/scss/style.scss 0 bytes [built] [failed] + 1 hidden modules ERROR in ./static/scss/style.scss Module parse failed: /home/zdelagrange/src/portal/cust-portal/bitsight/static/scss/style.scss Unexpected character '@' (1:0) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected character '@' (1:0) at Parser.pp.raise (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack/node_modules/acorn/dist/acorn.js:920:13) at Parser.pp.getTokenFromCode (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack/node_modules/acorn/dist/acorn.js:2813:8) at Parser.pp.readToken (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack/node_modules/acorn/dist/acorn.js:2508:15) at Parser.pp.nextToken (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack/node_modules/acorn/dist/acorn.js:2500:71) at Parser.parse (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack/node_modules/acorn/dist/acorn.js:1615:10) at Object.parse (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack/node_modules/acorn/dist/acorn.js:882:44) at Parser.parse (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack/lib/Parser.js:902:15) at DependenciesBlock.<anonymous> (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack/lib/NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10) at nextLoader (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25) at /home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5 at Storage.finished (/home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16) at /home/zdelagrange/src/portal/cust-portal/bitsight/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:405:3) @ ./static/js/file.js 3:0-29
but when I use this for the scss loader, it works fine:
{ test: /\.scss$/, include: /.scss$/, exclude: [ static_scss, static_scss_pdf ], loaders : [ 'style-loader', 'css-loader?sourceMap', 'sass-loader?sourceMap' ] },
source share