2019년 3월 5일 화요일

웹펙에서 css파일을 추가하고 webpack.config.js 에서 로더를 설정하다가 만난 에러







ERROR in ./src/css.css (./node_modules/css-loader!./node_modules/style-loader!./node_modules/css-loader!./src/css.css)
Module build failed (from ./node_modules/css-loader/index.js):
Unknown word (5:1)

  3 | // load the styles
  4 | var content = require("!!../node_modules/css-loader/index.js!./css.css");
> 5 | if(typeof content === 'string') content = [[module.id, content, '']];
    | ^
  6 | // Prepare cssTransformation
  7 | var transform;
  8 |

 @ ./src/css.css (./node_modules/style-loader!./node_modules/css-loader!./src/css.css) 4:14-146

before

const path = require('path')
module.exports = {
entry:'./src/entry.js',
output:{
path:path.resolve(__dirname,'dist'),
// path:__dirname+'/dist',
filename:'bundle.js'
},
module:{
rules:[
{
test:/\.css$/,
use:[{loader:"style-loader"},{loader:"css-loader"}]
}
]
}
}


after

const path = require('path')
module.exports = {
entry:'./src/entry.js',
output:{
path:path.resolve(__dirname,'dist'),
// path:__dirname+'/dist',
filename:'bundle.js'
},
module:{
rules:[
{ test: /.scss$/, use: [ "style-loader" , "css-loader" ] }
]
}
}

댓글 없음: