Reputation: 1839
I am trying to use the following code in my vue.config.js file, but it is giving me errors that module is not allowed. I am aware that there are configureWebpack and chainWebpack options, but I have no idea how to convert the following to use them. Any help would be appreciated
var path = require('path');
module.exports = {
foo:{},
bar{},
// Putting module in here does not work
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'scss': [
'vue-style-loader',
'css-loader',
{
loader: "sass-loader",
options: {
includePaths: [
path.resolve(__dirname, "./node_modules/@syncfusion")
]
}
}
]
}
}
}
]
}
}
and in my vue file
<style lang="scss">
@import 'subfolder-inside-syncfusion/some-file.scss';
</style>
Link to code I found:
https://www.syncfusion.com/forums/139116/scss-files-when-included-in-my-file-doesnt-work-as-expected
Upvotes: 1
Views: 2990
Reputation: 8706
You dont have to tap into the webpack config, if all you need is to include a global SCSS file. To import @syncfusion
from node_modules
, you can setup your vue.config.js
like so:
css: {
loaderOptions: {
sass: {
data: `@import "~@syncfusion";`
}
}
}
For more info, see the Vue docs "Working with CSS".
Upvotes: 1