question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add options to Vue CSS loaders

See original GitHub issue

Description:

I can’t seem to find a way to add options to Vue CSS loaders. For example, I’d like to add includePaths to Vue’s sass-loader, but I don’t see an option anywhere in the API. I’ve looked in laravel-mix/src/builder/webpack-rules.js, but there doesn’t seem to be a place I can leverage.

Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

1reaction
lysz210commented, Mar 20, 2018

with laravel-mix 2.0 it can be done extending mix. With the mix.extend function you get the compiled webpack config, then find vue-loader and add the i18n loader, i preferd webpack-merge.smart

mix.extend('addI18nLoader', (webpackConfig, ...args) => {
    let vueLoader = webpackConfig.module.rules.find(loader => loader.loader == 'vue-loader')
    vueLoader.options = require('webpack-merge').smart(
        vueLoader.options,
        {
            loaders: {
                i18n: '@kazupon/vue-i18n-loader'
            }
        }
    )
})
mix.addI18nLoader()
...
1reaction
mrcsmclncommented, Aug 27, 2017

@xxRockOnxx you need the exclude property in that config because Mix uses merge.smart() from webpack-merge and merge.smart() requires that the properties be the same to override a specific rule block.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Modules - Vue Loader
CSS Modules is a popular system for modularizing and composing CSS. vue-loader provides first-class integration with CSS Modules as an alternative for ...
Read more >
Vue scoped styles: webpack 5 & css-loader 4 - Stack Overflow
add ident: 'css-loader-ident' to the css-loader config (same level as options ). So far I have not gotten a webpack config that will...
Read more >
Add options to Vue CSS loaders · Issue #875 - GitHub
I can't seem to find a way to add options to Vue CSS loaders. For example, I'd like to add includePaths to Vue's...
Read more >
How To Add Loading Indicators to a Vue.js Application
In this article, you explored some of the ways to add a loading indicator to your Vue.js app. Loading indicators are a useful...
Read more >
style-loader - webpack
module.exports = { module: { rules: [ { test: /\.css$/i, use: [ { loader: "style-loader", options: { insert: function insertAtTop(element) { var parent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found