vue-loader: use style tag can't work(CssSyntaxError)
Version
15.0.0、15.0.6
Reproduction link
https://coding.net/u/huzedong2011/p/html/git
Steps to reproduce
1、npm i 2 、npm run build
What is expected?
<template>
<div>
<h1>Hello Word</h1>
<router-link to="/product">产品</router-link>
</div>
</template>
<style>
body {
background-color: #F00;
}
</style>
What is actually happening?
ERROR in ./src/pages/home/index.vue?vue&type=style&index=0&lang=css (./node_modules/_vue-loader@15.0.6@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_vue-style-loader@4.1.0@vue-style-loader!./node_modules/_css-loader@0.28.11@css-loader!./node_modules/_postcss-loader@2.1.4@postcss-loader/lib!./node_modules/_vue-loader@15.0.6@vue-loader/lib??vue-loader-options!./src/pages/home/index.vue?vue&type=style&index=0&lang=css) Module build failed: CssSyntaxError: D:\www\html\src\pages\home\index.vue:5:1: Unknown word at Input.error (D:\www\html\node_modules_postcss@6.0.22@postcss\lib\input.js:119:22) at Parser.unknownWord (D:\www\html\node_modules_postcss@6.0.22@postcss\lib\parser.js:506:26) at Parser.other (D:\www\html\node_modules_postcss@6.0.22@postcss\lib\parser.js:171:18) at Parser.parse (D:\www\html\node_modules_postcss@6.0.22@postcss\lib\parser.js:84:26) at parse (D:\www\html\node_modules_postcss@6.0.22@postcss\lib\parse.js:24:16) at new LazyResult (D:\www\html\node_modules_postcss@6.0.22@postcss\lib\lazy-result.js:70:24) at Processor.process (D:\www\html\node_modules_postcss@6.0.22@postcss\lib\processor.js:117:12) at compileStyle (D:\www\html\node_modules_@vue_component-compiler-utils@1.2.1@@vue\component-compiler-utils\dist\compileStyle.js:34:35) at Object.module.exports (D:\www\html\node_modules_vue-loader@15.0.6@vue-loader\lib\loaders\stylePostLoader.js:9:33) @ ./src/pages/home/index.vue?vue&type=style&index=0&lang=css 1:0-438 1:454-457 1:459-894 1:459-894 @ ./src/pages/home/index.vue @ ./src/router/index.js @ ./src/index.js @ multi ./node_modules/_webpack-dev-server@3.1.4@webpack-dev-server/client?http://0.0.0.0:8080 webpack/hot/dev-server ./src

V14.2.2 success V15.0.0 error
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (3 by maintainers)
Commits related to this issue
- fix .vue 文件中 style 标签导致的 cssSyntaxError 升级 vue-loader 到 15.0.7 之前错误原因主要是 vue-loader 15.0.6 没有处理 cnpm 安装的 node_modules 中的一些路径情况,导致编译错误 ref: https://github.com/vuejs/vue-loader/issues/1284 — committed to codetalks-new/FlaskVueDemo by codetalks-new 6 years ago
- Update dependency vue-loader to v15 (#820) This Pull Request updates dependency [vue-loader](https://github.com/vuejs/vue-loader) from `^14.2.3` to `^15.0.0` <details> <summary>Release Notes<... — committed to neutrinojs/neutrino by renovate[bot] 6 years ago
- Update dependency vue-loader to v15 (#820) This Pull Request updates dependency [vue-loader](https://github.com/vuejs/vue-loader) from `^14.2.3` to `^15.0.0` <details> <summary>Release Notes<... — committed to acconrad/neutrino-dev by renovate[bot] 6 years ago
- fix: stylePostLoader injection for windows flat node_modules close #1284 — committed to xc2/vue-loader by yyx990803 6 years ago
@papac, i have the same error, did you solve this?
Hi, I have the same problem two. my project is at : https://github.com/banxi1988/FlaskVueDemo/tree/master/client
below is webpack.config.js
Once I add a
styletag in the TodoItem.vue file, It will produce errors as follows:After some search problem still, So I try to find the reason myself. let me look at the output below.
_vue-loader@15.0.6@vue-loader/lib/loaders/stylePostLoader.js:10:33In my opinion, I think the source should be a css source string, to me surprise the output was below:
hope this output will be help for the diagnose.