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

bug: 引入json文件会解析错误 #1392

Closed
overQ-N opened this issue Dec 24, 2022 · 2 comments
Closed

bug: 引入json文件会解析错误 #1392

overQ-N opened this issue Dec 24, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@overQ-N
Copy link

overQ-N commented Dec 24, 2022

使用create-dumi生成的最简模板,在代码中引入了json文件会报错
image

image

Versions

  • dumi:2.0.2
  • node: v18.4.0
  • npm: 8.12.1
  • OS: Apple M1
  • Browser: Chrome 108.0.5359.124

Steps to reproduce

What is Expected?

dumi1.x可以正常引用json文件,2.x无法正常运行

What is actually happening?

只要引用json文件就会解析错误,项目template用的是Static Site

@overQ-N overQ-N added the bug Something isn't working label Dec 24, 2022
@overQ-N
Copy link
Author

overQ-N commented Dec 24, 2022

添加了json-loader解析,正常跑起来了

chainWebpack(memo, { env, webpack }) {
    memo.module
      .rule('compile')
      .type('javascript/auto')
      .test(/\.json$/)
      .use('babel')
      .loader('json-loader');
  }

// webpack比较菜,不清楚这样有无问题,还是希望dumi内置一下吧

@PeachScript
Copy link
Member

v2.0.18 已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants