Webpack: 一些关于新模板的问题 (postcss-loader missing in 1.2.0)

Created on 13 Nov 2017  ·  10Comments  ·  Source: vuejs-templates/webpack

我今天使用新的vue-cli创建了工程,但是我却不能像之前那样使用import正常的引入css(scss),一直报错提示我需要安装依赖。比如我引用element-ui theme,在main.js里import 'element-ui/lib/theme-chalk/index.css'就报以下的错误
This dependency was not found:

  • element-ui/lib/theme-chalk/index.css in ./src/main.js
    To install it, you can run: npm install --save element-ui/lib/theme-chalk/index.css
    还有,在/build下还发现了logo.png图片,我不是很明白这张图片存在的意义

Most helpful comment

手动安装一下 postcss-loader 应该就好了

npm install postcss-loader --save -D

All 10 comments

The same error:

import BootstrapVue from 'bootstrap-vue';

import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap-vue/dist/bootstrap-vue.css';

Vue.use(BootstrapVue);

These dependencies were not found:

  • bootstrap/dist/css/bootstrap.css in ./src/main.js
  • bootstrap-vue/dist/bootstrap-vue.css in ./src/main.js

To install them, you can run: npm install --save bootstrap/dist/css/bootstrap.css bootstrap-vue/d

手动安装一下 postcss-loader 应该就好了

npm install postcss-loader --save -D

Yep, postloader somehow got lost during a merge of a feature. I just added it in develop and will push an update shortly.

害人不浅啊,我就是说昨天我按照element-ui的官方文档做没有问题,今天要进入正式项目就出问题了,百思不得其解,原来是新模板的问题!好像爆粗!!!!!!

同样问题

it takes me hours to search the reasons , you can do
npm install postcss-loader --save -D

@caolingxiong 新模板的问题现在解决了么

@PanJiaChen 安装了npm install postcss-loader --save -D 依然不行

安装了npm install postcss-loader --save -D . 然后重新启动项目,发现webpack.base.conf.js文件下,
{
test: /.css$/,
loaders: ["style-loader", "css-loader", "postcss-loader"],
include: [] //没有加这个include
},
所以就会一直报错

安装了npm install postcss-loader --save -D . 然后重新启动项目,发现webpack.base.conf.js文件下,
{
test: /.css$/,
loaders: ["style-loader", "css-loader", "postcss-loader"],
include: [] //没有加这个include
},
所以就会一直报错

It works for me,thx

Was this page helpful?
0 / 5 - 0 ratings