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.

`Undefined node "type"` error will occur when I use webpack in production mode

See original GitHub issue

When I pack code in development mode, it will work properly. But if I use production mode, error like bellow will occur everytime.

Input is: ['a' => 1]:

Uncaught Error: Undefined node "string"
    at main.js:210
    at n.read_scalar (main.js:174)
    at n.read_expr_item (main.js:144)
    at n.read_expr (main.js:144)
    at n.read_array_pair_list (main.js:129)
    at n.read_array (main.js:129)
    at n.read_scalar (main.js:174)
    at n.read_expr_item (main.js:144)
    at n.read_expr (main.js:144)
    at n.read_statement (main.js:179)

I’ve tried both 2.x & 3.x-alpha, same result got.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
takashikicommented, Aug 22, 2018

I used webpack with minimal config like bellow for a test, and got that error:

const path = require('path');

module.exports = {
    entry: './src/index.js',
    output: {
        path: path.join(__dirname, 'dist'),
        filename: '[name].js'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: {
                  loader: 'babel-loader',
                  query: {
                    presets: ['env', 'stage-0']
                  }
                }
            }
        ]
    },
    devServer: {
        contentBase: path.join(__dirname, "dist"),
        port: 9090,
        host: 'localhost',
        overlay: true,
        compress: true
    }
}

And when I used it in my project with a complicated config file, I got that error too.

However, it worked properly when I tested with your webpack config.

0reactions
ichiriaccommented, Sep 1, 2018

Hi @takashiki, the problem should be resolved by using version 3.0.0-prerelease.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack production mode - NODE_ENV undefined
Way I found is to use argv.mode variable inside export like so: module.exports = (env, argv) => { const isDevelopment = argv.mode !==...
Read more >
Uncaught TypeError: Cannot read property 'call' of undefined
HMR provided by webpack crashes, with the error: "Uncaught TypeError: Cannot read property 'apply' of undefine" as shown in the following issue ...
Read more >
Externals - webpack
The externals configuration option provides a way of excluding dependencies from the output bundles. Instead, the created bundle relies on that dependency ...
Read more >
How I solved and debugged my Webpack issue through trial ...
You can actually do npm start , without the run command ? ... "scripts": { "build": "webpack --mode production", "dev": ...
Read more >
Node.js v19.3.0 Documentation
Functions to convert from C types to Node-API ... removal may occur in any future release. Use of the feature is not recommended...
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