question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when compiling with babel-webpack

See original GitHub issue

HI @everyone

I’m getting some weird output after transpiled the library in webpack with babel.

Specifically, an Unexpected token: punc (:) error on .[/~/debug/node.js:122,0]

Point is, it’s transpiling lines like:

122:         process.env.DEBUG = namespaces;

into:

122:         {"NODE_ENV":"production"}.DEBUG = namespaces;

Why would it transpile process.env into that object?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
bensteppcommented, Nov 16, 2016

This workaround worked for us using the DefinePlugin.

new webpack.DefinePlugin({
    'process.env.NODE_ENV': JSON.stringify('production'),
}),
3reactions
TooTallNatecommented, Nov 16, 2016

Closing, since this is an issue with your webpack configuration, not with debug itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when compiling with webpack and babel-loader
According to the error it seems that redux is complaining about the stage option. It is probably because redux is still using Babel...
Read more >
Problem: Babel isn't compiling my code how I expected
I just setup my Webpack project but Babel isn't compiling the way it should!
Read more >
Webpack Compilation Error: Cannot find module - Babel ...
Current behavior: The test doesn't start and an error message is displayed Desired behavior: Test work as they were in version 4.12 Test ......
Read more >
babel-loader - webpack
core-js and webpack/buildin will cause errors if they are transpiled by Babel. You will need to exclude them form babel-loader . { "loader":...
Read more >
Webpack build error - Questions - Babylon.js Forum
It's the “null coalescing operator” that you need to configure babel for. I wonder why Babylon doesn't target an older ES version, since...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found