Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级antd 4.0报 Cannot use import statement outside a module #222

Open
closertb opened this issue Jul 1, 2020 · 4 comments
Open

升级antd 4.0报 Cannot use import statement outside a module #222

closertb opened this issue Jul 1, 2020 · 4 comments

Comments

@closertb
Copy link

closertb commented Jul 1, 2020

由于Bisheng 的webpack 配置含有一句配置:

module: {
      noParse: [/moment.js/],
      // ...
}

导致在对antd 的时间导入包:"./node_modules/rc-picker/es/generate/moment.js"存在不编译问题;

导致加载时出现:Cannot use import statement outside a module

image

@QinXianjun
Copy link

我也遇到了这个问题,请问你解决了吗?
如果解决了,麻烦告知一下怎么处理的好吗?谢谢。

@closertb
Copy link
Author

closertb commented Nov 3, 2020

我也遇到了这个问题,请问你解决了吗?
如果解决了,麻烦告知一下怎么处理的好吗?谢谢。

config.plugins.push(new AntdDayjsWebpackPlugin());

加了个这个插件吧。。。可以去看看我antd-doddle那个项目。。

@QinXianjun
Copy link

好的,谢谢。

@PeckZeg
Copy link

PeckZeg commented Mar 10, 2021

我尝试通过 webpackConfig 配置把 noParse 规则删掉之后就没这问题了。

module.exports = {
  webpackConfig(config) {
    delete config.module.noParse;
    return config;
  }
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants