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.

`init is not defined` when transpiled with webpack

See original GitHub issue

I’m trying to transpile my project which has some dependencies that are using debug, and I got an error when I try to transpile it with this webpack config :

{
  target : "node",
  module : {
    rules : [{
      test    : /\.js$/,
      loader  : "babel-loader",
      options : {
        babelrc : false,
        presets : [
          ["@babel/preset-env", {
            "targets": { 
            "node": "6.11.2"
            }
        }]
       ]
      }
    }]
  }
}

The stacktrace is leading me to "./node_modules/debug/src/node.js" with this error "ReferenceError: init is not defined" I’m using node.js v12.13.1, with webpack 4.41.5 and babel 7.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Qix-commented, Jan 12, 2020

@yvele @gdepouilly Closing for now. Feel free to link back to this issue from the issue you open with Microsoft, for visibility and tracking purposes. 😃

2reactions
Qix-commented, Jan 8, 2020

Honestly, it looks like microsoft’s engine doesn’t support function hoisting, which is odd since it’s part of the javascript specification.

Read more comments on GitHub >

github_iconTop Results From Across the Web

init is not defined when transpiled with webpack #735 - GitHub
I'm trying to transpile my project which has some dependencies that are using debug, and I got an error when I try to...
Read more >
How to transpile ES modules with webpack and Node.js
Learn how webpack interacts with and supports ES modules in this deep dive tutorial on transpilation in Node.js.
Read more >
Webpack not transpiling Typescript - Stack Overflow
I tried awesome-typescript-loader and ts-loader but both are not working when I try to use ES6/TypeScript features in my code, like defining ......
Read more >
TypeScript - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
cannot access before initialization webpack - You.com | The AI ...
With transpiled code it just logs undefined . It only gives an error with native modules no matter if the export is a...
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