The .styl file was not extracted after webpack4 introduced stylus and css, npm run build.

the .styl file was not extracted after webpack4 introduced stylus and css, build

index.js
import "./index.styl" app.[hash:8].css
import "./main.css" // main.css 

webpack.config.prod.js

module.exports = merge(webpackCommon, {
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ExtractPlugin.extract({
                    fallback: "style-loader",
                    use: [
                        "css-loader"
                    ]
                })
            },
            {
                test: /\.styl/,
                use: ExtractPlugin.extract({
                    fallback: "style-loader",
                    use: [
                        "css-loader",
                        {
                            loader: "postcss-loader",
                            options: {
                                sourceMap: true 
                            },
                        },
                        "stylus-loader"
                    ]
                })
            }
        ]
    },
    plugins: [
        // ...
        new ExtractPlugin("app.[hash:8].css")
    ]
  }

but in the webpack.config.dev.js, development environment, the .styl style is normally inserted into index.html "s head


module.exports = merge(webpackCommon, {
    // ...
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ["style-loader", "css-loader"]
            },
            {
                test: /\.styl$/,
                use: [
                    "style-loader",
                    "css-loader",
                    {
                    loader: "postcss-loader",
                    options: {
                        // postcssstylustree
                        sourceMap: true,
                        }
                    },
                    "stylus-loader"]
            }
        ]
    },
    plugins: [
       // ... 
    ]
})
index.styl

clipboard.png

main.css

clipboard.png

npm run buildapp.hash.css

clipboard.png

npm run dev

clipboard.png


thanks for inviting ~ is the problem solved?
may be a problem with extracting the version of the plug-in ExtractPlugin .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3251e-2b350.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3251e-2b350.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?