控制檯出現的錯誤以下:javascript
webpack.config.js中的配置以下:css
module.exports={
entry:'./src/main.js',
output:{
path:__dirname,
filename:'dist/app.js'
},
module:{
rules:[
{test:/\.js/,loader:'babel-loader',exclude:/node_modules/},
{test:/\.css/,loader:'css-loader!style-loader'},
{test:/\.(png|jpeg|jpg|ttf|gif)/,loader:'file-loader'}
]
},
devServer:{
disableHostCheck:true
}
}
package.json中安裝信息以下:java
"devDependencies": { "babel-core": "^6.26.3", "babel-loader": "^7.1.5", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "css-loader": "^2.0.2", "file-loader": "^3.0.1", "style-loader": "^0.23.1", "webpack": "^4.28.1", "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.13" },
插件頁面是這樣引入css文件的:node