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

Vuetify loader with webpack 5 #3003

Closed
dfabreguette opened this issue Apr 30, 2021 · 3 comments
Closed

Vuetify loader with webpack 5 #3003

dfabreguette opened this issue Apr 30, 2021 · 3 comments

Comments

@dfabreguette
Copy link

Hi,
I've created a while back this issue #2239 concerning dart sass vs node-sass used in version 4 of webpacker rails gem.
I recently seen webpacker 5 upgrade so I gave it a shot, thinking the removal of node-sass would solve my problems but I'm still stuck with those errors :

  app/packs/entrypoints/my-custom-component.vue 2:8  root stylesheet
SassError: SassError: Expected newline.
  ╷
2 │ export {};

which points to <style lang="scss"></style> section in my components.

Here's my base.js file :

const { webpackConfig, merge } = require("@rails/webpacker");
const vueConfig = require("./rules/vue");
const vuetifyConfig = require("./rules/vuetify");

module.exports = merge(vueConfig, vuetifyConfig, webpackConfig);

Here's my vuetify.js rule file :

module.exports = {
  module: {
    rules: [
      {
        test: /\.s(c|a)ss$/,
        use: [
          "vue-style-loader",
          "css-loader",
          {
            loader: "sass-loader",
            // Requires sass-loader@^7.0.0
            options: {
              implementation: require("sass"),
              indentedSyntax: true // optional
            },
            // Requires >= sass-loader@^8.0.0
            options: {
              implementation: require("sass"),
              sassOptions: {
                indentedSyntax: true // optional
              }
            }
          }
        ]
      }
    ]
  },
  resolve: {
    extensions: [".scss", ".sass"]
  }
};

Here's my vue.js rule file :

const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: 'vue-loader'
            }
        ]
    },
    plugins: [new VueLoaderPlugin()],
    resolve: {
        extensions: ['.vue'],
    },
}

Did anyone have same issues ?

@mcmire
Copy link

mcmire commented May 3, 2021

Two things:

  1. You seem to have two versions of options in your config, is that intentional?
  2. Are you able to post what my-custom-component.vue is?

@iuri-gg
Copy link

iuri-gg commented May 17, 2021

you need to customize vuetify.js rule. the guide you copied it from gives you options for different versions ofs sass-loader. You should keep only one according to which version you are using. Offending lines (keep only one of the options):

            // Requires sass-loader@^7.0.0
            options: {
              implementation: require("sass"),
              indentedSyntax: true // optional
            },
            // Requires >= sass-loader@^8.0.0
            options: {
              implementation: require("sass"),
              sassOptions: {
                indentedSyntax: true // optional
              }
            }

@dhh dhh closed this as completed Aug 20, 2021
@dfabreguette
Copy link
Author

Thx I'll give a try when I'll get back on this project !

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

4 participants