报错信息
main.js
import vue from 'vue';
import vueRouter from 'vue-router';
import app from './app.vue';
import routes from './routes/routes.js';
vue.use( vueRouter );
let router = new vueRouter();
router.addRoutes( routes );
import './css/global.css'; //此行会报错
new vue({
el:'#app',
router,
render: c => c(app)
});
webpack.config.js
module:{
rules:[
{
test:/\.css$/,
loader:'style-loader!css-loader!autoprefixer'
},{
test:/\.js$/,
loader:'babel-loader',
exclude:/node_modules/
},{
test:/\.(png|jpe|jpeg|gif|svg)$/,
loader:'file-loader',
query:{
name:'dist/imges/[name][hash:8].[ext]'
}
},{
test:/\.vue$/,
loader:'vue-loader'
},{
test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader',
query:{
name:'dist/fonts/[name][hash:8].[ext]'
}
}
]
},
css放在style标签里面导入