我正在尝试在React Web和React本机项目之间共享代码。
文件夹结构如下:
web/
shared/redux/
native/
如您所见,我已将web / src / redux文件夹移至shared / redux。
在config-overrides.js中,我可以像这样禁用de ModuleScopePlugin:
const removeSrcRestriction = value => config => {
config.resolve.plugins = config.resolve.plugins.filter(plugin => !(plugin instanceof ModuleScopePlugin));
return config
};
module.exports = override(
removeSrcRestriction('self'),
...
在网络中/我执行纱线构建以查看一切是否正常。 我收到以下错误:
Failed to compile.
../shared/redux/store.ts 15:19
Module parse failed: Unexpected token (15:19)
You may need an appropriate loader to handle this file type.
| let middleware = [ logger, epicMiddleware, reduxPollingMiddleware ];
|
> const persistConfig: PersistConfig = {
| key: 'root',
| storage: storage,
有人知道如何解决吗?