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

Missing .hub leads to TypeError: Cannot read property 'file' of undefined #8641

Closed
loganfsmyth opened this issue Sep 6, 2018 · 2 comments · Fixed by #10575
Closed

Missing .hub leads to TypeError: Cannot read property 'file' of undefined #8641

loganfsmyth opened this issue Sep 6, 2018 · 2 comments · Fixed by #10575
Labels
Has PR outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@loganfsmyth
Copy link
Member

Moved from babel/babel-loader#674 but will need a full reproduction example.

Webpack Version:
^4.17.2

Babel Core Version:
7.0

Babel Loader Version:
^8.0.0-beta.6

Please tell us about your environment:
Windows 7

Current behavior:
I upgraded my babel configuration from ^7.0.0-rc.2 to ^7.0.0, and then the compilation failed.

package.json:

"@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-decorators": "^7.0.0",
    "@babel/plugin-proposal-do-expressions": "^7.0.0",
    "@babel/plugin-proposal-export-default-from": "^7.0.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
    "@babel/plugin-proposal-optional-chaining": "^7.0.0",
    "@babel/plugin-proposal-throw-expressions": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-syntax-import-meta": "^7.0.0",
    "@babel/plugin-transform-runtime": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "@babel/preset-typescript": "^7.0.0",
    "@babel/runtime": "^7.0.0",
    "babel-loader": "^8.0.0-beta.6",

.babelrc

{
  "env": {
    "development": {
      "plugins": [
        "dynamic-import-node",
        "react-hot-loader/babel",
        "dva-hmr",
        ["import", { "libraryName": "antd", "style": "css" }]
      ]
    }
  },
  "presets": [
    [
      "@babel/preset-env",
      {
        "modules": false,
        "targets": {
          "browsers": ["IE >= 9"]
        },
        "useBuiltIns": "usage"
      }
    ],
    "@babel/preset-typescript",
    "@babel/preset-react"
  ],
  "plugins": [
    [
      "@babel/transform-runtime",
      {
        "helpers": false
      }
    ],
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    ["@babel/plugin-proposal-class-properties", { "loose": true }],
    "@babel/proposal-do-expressions",
    "@babel/proposal-export-default-from",
    "@babel/proposal-export-namespace-from",
    "@babel/proposal-optional-chaining",
    "@babel/proposal-throw-expressions",
    "@babel/syntax-dynamic-import",
    "@babel/syntax-import-meta"
  ]
}

output the following:

./src/pages/xshare-managment/router.tsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: Cannot read property 'file' of undefined

I tried set @babel/preset-env to ^7.0.0-rc.2 and compiled successfully!

Expected/desired behavior:

  • What is the expected behavior?
    use @babel/preset-env: ^7.0.0 and compiled successfully!
@bigbigbo
Copy link

@vipcxj
Copy link

vipcxj commented Mar 13, 2019

  const a = "b";
  const l = 'c';
  const obj = { b: 1, c: 2 };
  const { [a]: e, [l]: k, ...rest } = obj;

with dva-hmr plugin, this code trigger the bug.
@loganfsmyth any progress?

@JLHwung JLHwung added the Has PR label Oct 18, 2019
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jun 17, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Has PR outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants