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

Export 'IValues' is not defined #9895

Closed
emilgpa opened this issue Apr 24, 2019 · 8 comments
Closed

Export 'IValues' is not defined #9895

emilgpa opened this issue Apr 24, 2019 · 8 comments
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@emilgpa
Copy link

emilgpa commented Apr 24, 2019

Bug Report

Current Behavior

Export 'IValues' is not defined.

ERROR in ./ts/components/sections/ajustar_descuadre.tsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\ts\components\sections\ajustar_descuadre.tsx: Export 'IValues' is not defined (44:8)

  42 | }
  43 | 
> 44 | export {IValues as IAjustarDescuadreValues}
     |         ^
  45 | 
  46 | interface IBaseProps {
  47 |     importValue: string
    at Object.raise (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:3851:17)
    at Object.parseTopLevel (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:7226:14)
    at Object.parse (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:8863:17)
    at parse (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:11135:38)
    at parser (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\lib\transformation\normalize-file.js:170:34)
    at normalizeFile (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\lib\transformation\normalize-file.js:138:11)
    at runSync (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\lib\transformation\index.js:44:43)
    at runAsync (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\lib\transformation\index.js:35:14)
    at process.nextTick (C:\Front BPM\Cuadre\trunk\Cuadre\WebContent\node_modules\@babel\core\lib\transform.js:34:34)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
 @ ./ts/components/sections/detalle_descuadre_cerrado/detalle_descuadre_cerrado.tsx 56:48-81
 @ ./ts/components/index.ts
 @ ./ts/app.tsx
 @ ./ts/main.tsx

Input Code

  • code wrriten in TypeScript and React. Nothing special.

Expected behavior/code
Should successfully transpile.

Babel Configuration (.babelrc, package.json, cli command)

{
  "presets": [
    "@babel/react",
    "@babel/typescript",
    [
      "@babel/env",
      {
        "modules": false,
        "targets": {
          "ie": "11",
          "chrome": "58"
        }
      }
    ]
  ],
  "plugins": [
    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true
      }
    ],
    [
      "@babel/plugin-proposal-class-properties",
      {
        "loose": true
      }
    ],
    "@babel/proposal-object-rest-spread",
    "@babel/plugin-transform-react-jsx",
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-transform-runtime"
  ]
}

Environment

  • Babel version(s): ev7.4.3
  • Node/npm version: Node 8.9.4/npm 5.6.0
  • OS: Windows 10
  • Monorepo: yes
  • How you are using Babel: loader
@babel-bot
Copy link
Collaborator

Hey @emilgpa! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo
Copy link
Member

Fixed by #9766, released in v7.4.4

@emilgpa
Copy link
Author

emilgpa commented May 9, 2019

@nicolo-ribaudo I recently update babel to 7.4.4 but I still have the same error. I don't know if I'm missing something (I use babel-loader)

ERROR in ./ts/components/_table/with_filter.tsx 21:9
Module parse failed: Export 'IContext' is not defined (21:9)
You may need an appropriate loader to handle this file type.
| import Table from './table';
| import Filter from './filter';
> export { IContext as IWithFilterContext };
| var TableFilter = (_dec = inject('uiStore', 'appStore', 'dataStore'), _dec(_class = observer(_class = (_temp = _class2 =
| /*#__PURE__*/
 @ ./ts/components/sections/lista_tareas/lista_tareas.tsx 23:0-61 1206:79-96
 @ ./ts/components/index.ts
 @ ./ts/app.tsx
 @ ./ts/main.tsx

@emilgpa
Copy link
Author

emilgpa commented May 9, 2019

@nicolo-ribaudo Maybe 7.4.4 version handles export {example} (#9745) but not with as keyword like export {example as example1}??

@nicolo-ribaudo
Copy link
Member

It should work 🤔
What does npx nls why @babel/parser say?

@emilgpa
Copy link
Author

emilgpa commented May 9, 2019

@nicolo-ribaudo (the output is very long): https://hastebin.com/raw/howekupupa

@bflatmajor
Copy link

No help with updating 7.4.4, even though there is no as syntax.

@TheAifam5
Copy link

TheAifam5 commented Jun 4, 2019

Please reopen this issue since is not fixed. @nicolo-ribaudo

I've set in package.json:

"resolutions": {
  "**/@babel/parser": "7.4.5"
}

The output file looks like this:

[...]
exports.LauncherModelSchema = LauncherModelSchema;
const _default = ILauncherModel;
var _default2 = _default;
exports.default = _default2;

ILauncherModel is an interface (type also has the same problem) defined in TypeScript file. LauncherModelSchema is a exported const variable.
Example:

interface ILauncherModel {
  id: string;
  name?: string;
}

export const LauncherModelSchema = {};

export default ILauncherModel;
type LauncherModel = {
  id: string;
  name?: string;
}

export const LauncherModelSchema = {};

export default ILauncherModel;

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Sep 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

5 participants