步骤:
1、配置文件webpack.config.js:
{
test://.css$/,
loader:'style-loader!css-loader'
}
坑1:-loader尾缀
坑2:Module build failed: Unknown word 模块创建失败:未知文字????
解决方案:注掉整个css的配置,即:
//{
//test://.css$/,
//loader:'style-loader!css-loader'
//}
2、入口文件main.js:
require('./assets/css/base.css');
或:
import './assets/css/base.css';
3、
$npm install style-loader css-loader --save-dev
4、调用css
<style>
@import './assets/css/base.css';
</style>
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/243627.html