我将rca与react-rewired包装器一起使用。为了向Webpack添加自定义配置,我创建了config-overrides.js
文件,在其中存储配置设置。我添加了一个babel-plugin-import
,这非常简单。但是现在我想使用moment-locales-webpack-plugin
在我的应用程序中仅配置一种语言环境以减少应用程序的权重。
const { override, fixBabelImports, addWebpackPlugin } = require('customize-cra');
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
module.exports = override(
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
}),
addWebpackPlugin(MomentLocalesPlugin, { localeToKeep: ['us'] }),
);
yarn start
之后显示给我:
无法编译。
MomentLocalesPlugin: received unknown options: _pluginCompat, hooks, name, parentCompilation, outputPath, outputFileSystem, inputFileSystem, recordsInputPath, recordsOutputPath, records, removedFiles, fileTimestamps, contextT
imestamps, resolverFactory, infrastructureLogger, resolvers, options, context, requestShortener, running, watchMode, _assetEmittingSourceCache, _assetEmittingWrittenFiles, watchFileSystem. Only `localesToKeep` and `ignoreInva
lidLocales` options are supported at the moment
您能帮我吗?
由于错误:
目前仅支持
localesToKeep
和ignoreInvalidLocales
选项>>尝试将您的代码从
localeToKeep
更改为localesToKeep
。用s。