У меня проблема с порядком экспортируемых частей CSS в финальном файле. Вот моя установка:
├── css │ ├── style.css │ └── style.css.map ├── dist │ ├── bundle.js │ └── bundle.js.map ├── src │ ├── js │ │ ├── Caption.js │ │ └── functions.js │ ├── stylus │ │ ├── partials │ │ │ ├── colors.styl │ │ │ ├── frontpage.styl │ │ │ ├── header.styl │ │ │ ├── language-switcher.styl │ │ │ ├── mixins.styl │ │ │ ├── single.styl │ │ │ ├── site-title.styl │ │ │ └── typography.styl │ │ ├── shame.css │ │ └── style.styl │ └── app.js
а вот мой webpack.config.js
const webpack = require('webpack'); const path = require('path'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); const extractPlugin = new ExtractTextPlugin({ filename: '../css/style.css', allChunks: false }); const uglifyJS = new UglifyJsPlugin({ test: /\.js($|\?)/, sourceMap: true, uglifyOptions: { // ecma: 6 // mangle: false, // compress: false } }); const config = { entry: './src/app.js', output: { path: path.resolve(__dirname, './dist'), filename: 'bundle.js', publicPath: '/dist' }, devtool: 'source-map', // devServer: { contentBase: './dist' }, module: { rules: [ { test: /\.js$/, exclude: /(node_modules|bower_components)/, use: [ { loader: 'babel-loader', options: { presets: ['@babel/preset-env'], sourceMap: true } } ] }, { test: /\.styl$/, use: extractPlugin.extract({ use: [ { loader: 'css-loader', options: { importLoaders: 1, sourceMap: true } }, { loader: 'postcss-loader', options: { sourceMap: true } }, { loader: 'stylus-loader', options: { sourceMap: true } } ] }) } ] }, plugins: [ extractPlugin, uglifyJS ] } module.exports = config;
Итак, у меня есть приложение с одной точкой входа, импортирующее лист src/stylus/style.styl
Stylus, которое выглядит так:
@require './partials/colors' @require './partials/mixins' @require './partials/*' @require './shame.css'
Однако css/style.css
содержит содержимое shame.css
первым. Я нашел несколько тикетов по этому поводу на github Extract-text-webpack-plugin, но ни один из них, похоже, не решает эту проблему. Любые идеи, как заставить плагин извлечения работать?