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 CLI 3 Example #48

Open
btn0s opened this issue Nov 28, 2018 · 4 comments
Open

Vue CLI 3 Example #48

btn0s opened this issue Nov 28, 2018 · 4 comments

Comments

@btn0s
Copy link

btn0s commented Nov 28, 2018

Not sure where to start trying to get this to work with vue CLI 3.0 -- But I'm poking around and will update here if I do. Anyone else done this?

@prncc
Copy link
Contributor

prncc commented Dec 16, 2018

I don't have experience with this, so I can't make a more meaningful comment without looking into it, but I do plan on exposing (and slightly modifying) internal utilities so that a static theme.scss file can be easily produced with the plugin. That should make the build non-dynamic, but compatible with a wider range of tools.

@PomeloMan
Copy link

My solution is to add the following code in the vue.config.js file.
Note: In view of #68, please ensure that the sass-loader version is below 8

module.exports = {
  ......
  configureWebpack: config => {
    config.plugins.push(new AntdScssThemePlugin('./theme.scss'))
  }
  chainWebpack(config) {
    const oneOfs = ['vue-modules', 'vue', 'normal-modules', 'normal']
    oneOfs.forEach(oneOf => {
      config.module.rule('less').oneOf(oneOf)
        .use('less-loader')
        .loader(AntdScssThemePlugin.themify('less-loader').loader)
        .options({
          sourceMap: !isProduction,
          javascriptEnabled: true
        })
      config.module.rule('sass').oneOf(oneOf)
        .use('sass-loader')
        .loader(AntdScssThemePlugin.themify('sass-loader').loader)
        .options({
          sourceMap: !isProduction,
          sassOptions: {
            indentedSyntax: true
          }
        })
      config.module.rule('scss').oneOf(oneOf)
        .use('sass-loader')
        .loader(AntdScssThemePlugin.themify('sass-loader').loader)
        .options({
          sourceMap: !isProduction,
          sassOptions: {
            indentedSyntax: true
          }
        })
    });
  }
  ......
}

@jsliu27
Copy link

jsliu27 commented Jul 3, 2020

@PomeloMan Hi, Could you look at this problem for me? The configuration is the same as yours
error in ./node_modules/_ant-design-vue@1.6.2@ant-design-vue/es/style/index.less

Module build failed (from ./node_modules/_antd-scss-theme-plugin@1.0.8@antd-scss-theme-plugin/build/dist/lib/antdLessLoader.js):
Could not compile the SCSS theme file "./theme.scss" for the purpose of variable extraction. This is likely because it contains a Sass error.

@ ./node_modules/_ant-design-vue@1.6.2@ant-design-vue/es/style/index.less 4:14-300 14:3-18:5 15:22-308
@ ./node_modules/_ant-design-vue@1.6.2@ant-design-vue/es/button/style/index.js
@ ./src/config/antd-component-import.ts
@ ./src/main.ts
@ multi ./node_modules/_webpack-dev-server@3.11.0@webpack-dev-server/client?http://192.168.31.56:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts

@chuyuandu
Copy link

seems like that your sass file has syntax error
perhaps you use some new syntax that your sass-loader don't supports

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

5 participants