Webpack: Cannot import CSS module(module was not found) .

Created on 8 Nov 2017  路  1Comment  路  Source: vuejs-templates/webpack

I tried to install semantic-ui with npm, and then import the css file in .Vue file. But it shows it cannot find module(which already installed in the node_modules ).
Here is part of my webpack.base.conf.js file:

  {test: /\.css$/, loader: "style!css?sourceMap!postcss"},

And I also installed css-loader and style-loader with npm:

npm install --save -dev css-loader style-loader sass-loader less-loader postcss-loader

Here is how I import

import  './semantic-ui-css/semantic.css'

However, it returns :

 ERROR  Failed to compile with 1 errors                                 23:56:57

This relative module was not found:

* ./semantic-ui-css/semantic.css in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/App.vue
> Listening at http://localhost:8080

I have no idea why this happen. Is it because something goes wrong with css-loader?

question

>All comments

  1. You forgot to show how you actually import that file
  2. This might be better asked on the forum @ forum.vuejs.org
Was this page helpful?
0 / 5 - 0 ratings