Style-import not working
See original GitHub issueVersion
15.0.0
Reproduction link
https://jsfiddle.net/CinKon/0w11j0o2/1/
Steps to reproduce
I followed the migration Guide for v.15, but can’t get it work. This is my webpack config:
export default {
entry: utils.removeEmpty(utils.entryPoints),
output: {
path: utils.paths.PUBLIC_PATH,
publicPath: './'
},
resolve: {
extensions: ['.vue', '.js'],
modules: [utils.resolve(utils.kittnConf.src.base), utils.resolve('node_modules')]
},
module: {
rules: [
{
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
options: {
configFile: ifProduction('./.eslintrc.js', './.eslintrc-dev.js'),
formatter: require('eslint-friendly-formatter')
},
exclude: /node_modules/,
include: utils.resolve(utils.kittnConf.src.base)
},
{
test: /\.js$/,
use: 'babel-loader',
include: utils.resolve(utils.kittnConf.src.base),
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'vue-style-loader', 'postcss-loader', 'css-loader']
},
{
test: /\.scss$/,
include: [utils.resolve(utils.kittnConf.src.style), utils.resolve(utils.kittnConf.src.js)],
exclude: [utils.resolve('node_modules'), utils.resolve(utils.kittnConf.dist.base)],
use: [
MiniCssExtractPlugin.loader,
'style-loader',
'vue-style-loader',
'css-loader',
'postcss-loader',
'sass-loader'
]
},
{
test: /\.(png|jpe?g|gif)(\?\S*)?$/,
exclude: path.resolve(utils.paths.IMAGE_ROOT),
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
fallback: 'file-loader',
outputPath: utils.assetsPath('img/'),
publicPath: utils.assetsPath('img/'),
name: '[name].[ext]'
}
}
]
},
{
test: /\.(eot|ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader',
query: {
outputPath: utils.assetsPath('fonts/'),
publicPath: 'fonts/',
name: '[name].[ext]'
}
},
{
test: /\.svg$/,
include: path.resolve(utils.paths.IMAGE_ROOT),
use: [
{
loader: 'svg-sprite-loader',
options: {
esModule: false,
extract: false,
spriteFilename: ifDevelopment(
utils.assetsPath('img/sprite.svg'),
utils.assetsPath('img/sprite.[hash].svg')
)
}
},
'svg-fill-loader',
'svgo-loader'
]
}
]
},
plugins: utils.removeEmpty([
new MiniCssExtractPlugin({
filename: utils.assetsPath('[name].css')
})
])
}
In my Vue-Files, I import *.scss files like this:
<style lang="scss" scoped>
@import '_assets/collapse';
</style>
What is expected?
Vue-Files are being processed correctly.
What is actually happening?
Errors:
ERROR in ./src/js/components/molecules/Collapse/Collapse.vue?vue&type=style&index=0&id=764b9471&lang=scss&scoped=true
Module parse failed: Unexpected character '@' (111:0)
You may need an appropriate loader to handle this file type.
|
|
| @import '_assets/collapse';
|
@ ./src/js/components/molecules/Collapse/Collapse.vue 4:0-92
@ ./src/js/components/organisms/TheSummary/TheSummary.vue?vue&type=script&lang=js
@ ./src/js/components/organisms/TheSummary/TheSummary.vue
@ ./src/js/components/templates/TheWrapper/TheWrapper.vue?vue&type=script&lang=js
@ ./src/js/components/templates/TheWrapper/TheWrapper.vue
@ ./src/js/app.vue?vue&type=script&lang=js
@ ./src/js/app.vue
@ ./src/js/vue-app.js
@ ./src/js/main.js
@ multi webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true&overlay=true ./src/js/main.js
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:5 (2 by maintainers)
Top Results From Across the Web
overriding css styles with @import not working - Stack Overflow
Declaring style-override.css after style.css inside head will solve the problem, but I want to use @import inside a css file. Adding !important ...
Read more >@import path is not working (Example) | Treehouse Community
First I have issue with directory linking on the href to the css file. but I solved the linking issue. The code below...
Read more >@import css not working | OutSystems
@import css not working · Open theme editor and click "Reset Theme Editor" · Create another theme (based on OutSystems UI) to do...
Read more >Solving the React Error: Not Picking Up CSS Style | Pluralsight
CSS helps in styling webpages, but sometimes code may not get properly imported or may show a few errors while it is being...
Read more >import - CSS: Cascading Style Sheets - MDN Web Docs
The @import CSS at-rule is used to import style rules from other valid stylesheets. An @import rule must be defined at the top...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/vuejs/vue-loader/issues/1251#issuecomment-384278913
@adamchenwei this is a year-old issue. The original problem was users upgrading from v14 to v15 missing the plugin which is required for v15.