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.

License info being included twice after Webpack 4 build

See original GitHub issue

Not sure if this is a Webpack issue or something with classnames. The reason I don’t think it is Webpack is because, in the bundled file, no other third party scripts are adding the license info twice.

I thought it was maybe because there is license info in index.js, bind.js & dedupe.js. However, I ruled this out after adding a test change in the copyright text in only index.js and the change was showing on both license comments in the bundle.

Webpack: v4.8.3 NPM: v5.6.0 Node: v8.1.1

Included below is my Webpack config plus a screen shot of the output.

webpack.config.js
const ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = {
    mode: 'production',
    devtool: "source-maps",
    entry: "./src/js/index.tsx",
    output: {
        path: __dirname + "/dist",
        filename: "js/bundle.min.js"
    },
    resolve: {
        extensions: [".ts", ".tsx", ".js", ".json"]
    },
    module: {
        rules: [
            {
                test: /\.(ts|tsx)$/,
                use: [
                    {
                        loader: 'ts-loader'
                    }
                ]
            },
            {
                test: /\.scss$/,
                use: ExtractTextPlugin.extract({
                    use: [{
                        loader: 'css-loader',
                    }, {
                        loader: 'sass-loader'
                    }],
                    fallback: 'style-loader'
                })
            }
        ]
    },
    plugins: [
        new ExtractTextPlugin({
            filename: 'css/bundle.min.css',
            allChunks: true,
        })
    ],
    externals: {
        "react": "React",
        "react-dom": "ReactDOM"
    },
};
bundle.min.js

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
vivcogitcommented, Sep 26, 2019

This bug fixed in terser. I think this issue can be closed

1reaction
dcousenscommented, Jul 20, 2018

This is because LICENSE.md is being included, and for whatever reason @JedWatson decided to put the LICENSE prefix in the index.js too… hence, twice.

I don’t think I want to ping @JedWatson the 1000’s of times necessary to get him to resolve this…

Read more comments on GitHub >

github_iconTop Results From Across the Web

All my code runs twice when compiled by Webpack
js$/, loaders: ['babel-loader'], include: path.join(__dirname, '../src') } ] } };. javascript · webpack.
Read more >
Entry Points - webpack
Single Entry Syntax is a great choice when you are looking to quickly set up a webpack configuration for an application or tool...
Read more >
How I solved and debugged my Webpack issue through trial ...
My debugging journey started with the following setup: webpack.config.js // webpack v4.6.0 const path = require('path');const ...
Read more >
Micro-frontends: Module Federation with WebPack 5
It allows a JavaScript application to dynamically load code from another application (a different Webpack build). This is how you normally use ...
Read more >
Using webpack with TypeScript - LogRocket Blog
Now, we need to add a webpack script that will run the webpack.config.js file for us. ... After running the build command, webpack...
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