我需要使用字体真棒。
PostCSS 尝试在源目录中查找字体,但不在 node_modules/font-awesome/fonts 中
错误文字:
Error: Can't resolve '../fonts/fontawesome-webfont.eot?v=4.7.0' in 'F:\OpenServer\domains\polymer-postcss\src'
进口:
@import "font-awesome/css/font-awesome.min.css";
webpack.config.js:
var cssPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {app: './src/app.js'},
output: {
path: './dist',
filename: '[name].js',
publicPath: '/dist/',
},
plugins: [new cssPlugin({filename: '[name].css'}),],
module: {
rules: [
{
test: /\.css$/,
loader: cssPlugin.extract({
use: 'css-loader?importLoaders=1&sourceMap!postcss-loader?sourceMap',
}),
},
{
test: /\.(svg|png|gif|jpe?g|woff|woff2|eot|ttf)$/i,
use: "url-loader?limit=10000&name=[path][name].[ext]?[hash]"
},
],
},
}
postcss.config.js
module.exports = {
plugins: {
'postcss-import': {},
'postcss-cssnext': {
browsers: ['last 2 versions', '> 20%'],
},
},
};