Skip to content
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

vue cli3 build 打包scss得到的css文件中的样式不包含非路由组件 #4339

Closed
SoldierAb opened this issue Jul 23, 2019 · 0 comments

Comments

@SoldierAb
Copy link

Version

3.8.3

Environment info

const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')

module.exports = {
  
  publicPath: '/',

  outputDir: 'dist',

  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.scss$/,
          use: ExtractTextPlugin.extract({
            fallback: "style-loader",
            use: [
              "css-loader",
              "sass-loader",
              {
                loader: 'sass-resources-loader',
                options: {
                  resources: path.resolve(__dirname, `./src/theme/${process.env.VUE_APP_THEME}.scss`)  //主题皮肤文件全局注入
                }
              }
            ]
          })
        },
      ]
    },
    plugins: [
      new ExtractTextPlugin({
        filename: `theme/${process.env.VUE_APP_THEME}.css`,
        allChunks: true     
      }),
    ],
   
  },




  css: {
   
    extract: false,

    sourceMap: false,
  

  },



}

Steps to reproduce

npm run build

What is expected?

打包所有的scss样式

What is actually happening?

打包scss得到的css文件中的样式 不包含非路由组件


//App.vue 该文件的scss样式和TopNav组件的scss样式不打包

<style lang="scss"></style>

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

1 participant