如何添加Webpack插件以进行重新连接

问题描述 投票:0回答:1

我将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

您能帮我吗?

reactjs webpack babel create-react-app
1个回答
0
投票

由于错误:

目前仅支持localesToKeepignoreInvalidLocales选项>>

尝试将您的代码从localeToKeep更改为localesToKeep。用s。

© www.soinside.com 2019 - 2024. All rights reserved.