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

roadhog 调试信息完善 #564

Open
callmez opened this issue Jan 10, 2018 · 7 comments
Open

roadhog 调试信息完善 #564

callmez opened this issue Jan 10, 2018 · 7 comments

Comments

@callmez
Copy link

callmez commented Jan 10, 2018

在升级到2.0的时候 出现了以下错误

Module build failed: Error: .plugins[1][1] must be an object, false, or undefined
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)

虽然报错但是没有详细的错误信息 而且很难定位信息....无从下手

@sorrycc
Copy link
Owner

sorrycc commented Jan 10, 2018

配置贴出来看下。

@callmez
Copy link
Author

callmez commented Jan 11, 2018

找到问题了是 babelPlugins报错, 用了antd, 和antd-mobile
在1的时候不会报错

{
  "entry": "src/pages/*.js",
  "outputPath": "../public",
  "extraBabelPlugins": [
    "transform-decorators-legacy",
    [
      "import", [
       { "libraryName": "antd", "libraryDirectory": "es", "style": true },
       { "libraryName": "antd-mobile", "libraryDirectory": "lib", "style": true }
     ]
   ]
  ],
  "env": {
    "development": {
      "extraBabelPlugins": [
        "dva-hmr"
      ]
    }
  },
  "ignoreMomentLocale": true,
  "theme": "./src/theme.js",
  "html": {
    "template": "./src/index.ejs"
  },
  "hash": true
}

@callmez
Copy link
Author

callmez commented Jan 11, 2018

请问在2里如何同时引用 antd和ant-mobile

@sorrycc
Copy link
Owner

sorrycc commented Jan 11, 2018

写两个 ['import', {}],babel@7 不支持数组格式的 option 了。

sorrycc added a commit that referenced this issue Jan 11, 2018
@callmez
Copy link
Author

callmez commented Jan 11, 2018

已解决, 但是有还有个问题就是 cli里显示的错误信息要不是不完全. 要不就会被截断看不到完整的错误信息. 这块的体验还请加强

@sorrycc
Copy link
Owner

sorrycc commented Jan 11, 2018

恩,这个 issue 先开着,我找时间完善下。

@callmez
Copy link
Author

callmez commented Jan 11, 2018

贴个可以用的配置, 重复使用插件需要 加个 unique name,

{
  "entry": "src/pages/*.js",
  "outputPath": "../public",
  "extraBabelPlugins": [
    "transform-decorators-legacy",
    ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }],
    ["import", { "libraryName": "antd-mobile", "libraryDirectory": "lib", "style": true }, "ant-mobile"]
  ],
  "env": {
    "development": {
      "extraBabelPlugins": [
        "dva-hmr"
      ]
    }
  },
  "ignoreMomentLocale": true,
  "theme": "./src/theme.js",
  "html": {
    "template": "./src/index.ejs"
  },
  "hash": true
}

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

No branches or pull requests

2 participants