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

Errors when ran through Babel #525

Closed
stevenvachon opened this issue Apr 26, 2018 · 5 comments
Closed

Errors when ran through Babel #525

stevenvachon opened this issue Apr 26, 2018 · 5 comments

Comments

@stevenvachon
Copy link

stevenvachon commented Apr 26, 2018

Compiling my code, which depends on v5.14.1 of this library, results in:

jsoneditor.js:38 Uncaught TypeError: Cannot set property 'JSONEditor' of undefined
    at webpackUniversalModuleDefinition (jsoneditor.js:38)
    at jsoneditor.js:30

and/or:

jsoneditor-minimalist.js:38 Uncaught TypeError: Cannot set property 'JSONEditor' of undefined
    at webpackUniversalModuleDefinition (jsoneditor-minimalist.js:38)
    at jsoneditor-minimalist.js:30

This is my .babelrc:

{
  "plugins": [
    ["transform-builtin-extend", {
      "globals": ["Error"]
    }],
    "transform-object-rest-spread"
  ],
  "presets": [
    ["env", {
      "targets": {
        "browsers": "last 2 versions"
      },
        "test": {
            "plugins": [
                ["istanbul",
                    {
                        "exclude": "*.+(test|stub|spec).*",
                        "useInlineSourceMaps": false
                    }
                ]
            ]
        },
      "useBuiltIns": true
    }]
  ]
}
@josdejong
Copy link
Owner

Looks like you're trying to bundle the bundled version of JSONEditor. I guess there is an issue because the bundled versions try to attach the JSONEditor object to window which is not available when bundling or something.

Maybe it works when bundling the source code instead, which is in the folder src?

@stevenvachon
Copy link
Author

stevenvachon commented Apr 26, 2018

My project does not currently use commonJS or ES modules, unfortunately.

@josdejong
Copy link
Owner

My project does not currently use commonJS or ES modules, unfortunately.

So what is your project using then?...

@stevenvachon
Copy link
Author

Concatenation and AngularJS modules

@josdejong
Copy link
Owner

I'm not sure how I can help you. I guess you will have to make sure window is defined at the start of your concatenated files or something like that.

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

2 participants