我正在尝试使用extract-text-webpack-plugin生成捆绑的 css 文件并使其按顺序生成。
现在,生成了 CSS 文件,但“ignoreOrder”似乎不起作用,内容的顺序不符合源代码的顺序。
//webpack.config.js
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ExtractSCSS = new ExtractTextPlugin({
filename: function(getPath) {
return getPath('css/[name].css');
},
allChunks: false
});
module.exports = {
entry: {
'index': './index.js',
// ......
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, ((env = 'develop') => {
let assignRoot = {
'develop': './develop/bundle/'
// ......
};
return assignRoot[env];
})(process.env.NODE_ENV))
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: [{
loader: 'imports-loader?this=>window,jQuery=>this.jQuery'
}, {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
},
{
test: /\.css$|\.scss$/,
use: ExtractSCSS.extract({
use: [
{
loader: 'css-loader',
options: {
minimize: true
}
},
{ loader: 'sass-loader' },
{
loader: 'preprocess-loader',
options: {
THEME: 'uplantravel'
}
}
],
})
}]
},
plugins: ExtractSCSS
};
我的 js 导入了一些 scss 和 js。
//index.js
import './@magaele/a.scss';
import './@magaele/b.scss';
import './@magaele/c/css.scss';
//......
import './@magaele/a/module.js';
import './@magaele/b/module.js';
import './@magaele/c/module.js';
//......
- 网络包版本:3.5.5
- 提取文本 webpack 插件版本:3.10.10