将iconfont网页包插件与Laravel Mix一起使用
我是webpack新手,正在尝试向Laravel项目添加自定义图标字体生成器。ICont库位于,并添加到webpack.config.js,如下所示:将iconfont网页包插件与Laravel Mix一起使用,laravel,webpack,Laravel,Webpack,我是webpack新手,正在尝试向Laravel项目添加自定义图标字体生成器。ICont库位于,并添加到webpack.config.js,如下所示: const IconfontWebpackPlugin = require('iconfont-webpack-plugin'); module: { rules: [ { test: /\.css$/, use: [ 'css-loader', {
const IconfontWebpackPlugin = require('iconfont-webpack-plugin');
module: {
rules: [
{
test: /\.css$/,
use: [
'css-loader',
{
loader: 'postcss-loader',
postcssOptions: (loader) => {
return {
plugins: [
new IconfontWebpackPlugin({
resolve: loader.resolve,
fontNamePrefix: 'custom-',
enforcedSvgHeight: 3000,
})
]
};
}
}
]
}
]
}
const IconfontWebpackPlugin = require('iconfont-webpack-plugin');
mix.webpackConfig({
module: {
rules: [
{
test: /\.css$/,
use: [
'css-loader',
{
loader: 'postcss-loader',
postcssOptions: (loader) => {
return {
plugins: [
new IconfontWebpackPlugin({
resolve: loader.resolve,
fontNamePrefix: 'custom-',
enforcedSvgHeight: 3000,
})
]
};
}
}
]
}
]
}
});
在中,我使用mix.webpackConfig()
函数,如下所示:
const IconfontWebpackPlugin = require('iconfont-webpack-plugin');
module: {
rules: [
{
test: /\.css$/,
use: [
'css-loader',
{
loader: 'postcss-loader',
postcssOptions: (loader) => {
return {
plugins: [
new IconfontWebpackPlugin({
resolve: loader.resolve,
fontNamePrefix: 'custom-',
enforcedSvgHeight: 3000,
})
]
};
}
}
]
}
]
}
const IconfontWebpackPlugin = require('iconfont-webpack-plugin');
mix.webpackConfig({
module: {
rules: [
{
test: /\.css$/,
use: [
'css-loader',
{
loader: 'postcss-loader',
postcssOptions: (loader) => {
return {
plugins: [
new IconfontWebpackPlugin({
resolve: loader.resolve,
fontNamePrefix: 'custom-',
enforcedSvgHeight: 3000,
})
]
};
}
}
]
}
]
}
});
这是一个生成错误:
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module.rules[12].use[1] has an unknown property 'postcssOptions'. These properties are valid:
object { ident?, loader?, options? }
在Laravel Mix中,正确的方法是什么