0
我已經設法將2個scss文件提取到1個css文件中,但我注意到在main.css.map
中的源和映射是空的:extract-text-webpack-plugin - 提取scss結果在main.css.map中沒有映射
我webpack.config.js
:
var autoprefixer = require('autoprefixer');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
devtool: 'source-map',
module: {
loaders: [
{test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000'},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract(['css', 'sass'])
}
}
]
},
entry: [
'./static/js/app.js'
],
output: {
filename: './static/js/bundle.js'
},
watch: false,
plugins: [
new ExtractTextPlugin("./main.css")
]
};
我app.js
:
var $ = require('jquery');
window.jQuery = $;
window.$ = $;
require('bootstrap-loader');
module.exports = (function() {
alert('IT WORKS!');
});
window.app = module.exports;
require('./../css/main.scss');
require('./../css/main2.scss');
從終端
webpack
的輸出:
Hash: 28bc2c1ea9d333be2975
Version: webpack 1.13.3
Time: 3500ms
Asset Size Chunks Chunk Names
89889688147bd7575d6327160d64e760.svg 109 kB [emitted]
./static/js/bundle.js 666 kB 0 [emitted] main
./main.css 126 kB 0 [emitted] main
./static/js/bundle.js.map 813 kB 0 [emitted] main
./main.css.map 87 bytes 0 [emitted] main
[0] multi main 28 bytes {0} [built]
[1] ./static/js/app.js 287 bytes {0} [built]
+ 29 hidden modules
Child extract-text-webpack-plugin:
+ 4 hidden modules
Child extract-text-webpack-plugin:
+ 4 hidden modules
正如你可以看到main.map.css
一起產生main.css
,但在這一點上是很沒用,因爲裏面沒有映射可言。