Skip to content

when the env is production,it generated css file is empty,but in development is right #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dongqizhen opened this issue May 3, 2018 · 2 comments

Comments

@dongqizhen
Copy link

dongqizhen commented May 3, 2018

this is my config in config.js

const devMode = process.env.NODE_ENV !== 'production'

in optimization:

splitChunks: {

        cacheGroups: {
            styles: {
              name: 'styles',
              test: /\.scss|css|sass$/,
              chunks: 'all',
              enforce: true
            }
        }
    },

in rules:
{
test: /.(sass|scss)$/,
use:
[
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
'sass-loader',
],
}

in plugin:
new MiniCssExtractPlugin({
filename: devMode ? 'css/[name].css' : 'css/[name].[hash].css',
chunkFilename: devMode ? 'css/[id].css' : 'css/[id].[hash].css',
})

the env is production that view :
7twx5zuw99 ibeo7tod79w

but in development :
c4vky vqejzuc3 5 2 _pe

@alexander-akait
Copy link
Member

@dongqizhen please use for this stackoverflow, gitter or slack, it is bug tracker, not QA service. Thanks!

@weizheng1992
Copy link

Have you solved this problem, please? I've also met this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants