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

Issue with webpack and multiple chunks #899

Closed
Margoot opened this issue May 26, 2020 · 1 comment
Closed

Issue with webpack and multiple chunks #899

Margoot opened this issue May 26, 2020 · 1 comment

Comments

@Margoot
Copy link

Margoot commented May 26, 2020

Since recently, I have in my dist 11 files with respectively "Preview", "DailyMotion", "Facebook", "Youtube" and so on named by [Number].js. Even when I have excluded the node_modules from my webpack config for babel-loader.
I would like to exclude those files to have exclusively the source files in my dist.

Here is my webpack config and a screenshot of my dist:

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  mode: "development",
  entry: {
    client: "./src/client.js",
    bundle: "./src/bundle.js",
  },
  output: {
    path: path.resolve(__dirname, "assets"),
    filename: "[name].js",
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        include: path.join(__dirname, 'src'),
        exclude: /node_modules/,
        loader: "babel-loader",
      },
      {
        test: /\.scss$/,
        loader: "style-loader!css-loader!sass-loader",
        exclude: /node_modules/,
      },
      {
        test: /\.(png|jpg|woff|woff2|woff|ttf|eot|otf|svg|ico)$/i,
        use: [
          {
            loader: "file-loader",
            options: {
              outputPath: "/files",
              limit: 8195,
              publicPath: "assets/files",
            },
          },
        ],
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      favicon: "./src/assets/images/favicon.ico",
    }),
  ],
};

And my dist files look like:

Capture d’écran 2020-05-26 à 21 29 50

Thanks for your precious help. I've spent hours looking for a solution but .. nothing works!

@Margoot Margoot changed the title Issue with webpack and multiple chunk Issue with webpack and multiple chunks May 26, 2020
@cookpete
Copy link
Owner

This is what I would expect in version 2.1.0, although the lack of proper chunk names is not ideal. The different players are now dynamically imported when they are needed, based on the url passed in. This results in a chunk for each player.

I imagine you can get more control of how things are chunked with SplitChunksPlugin but I need to look into it properly.

I will add some comments to give chunks names (eg reactPlayerYouTube, reactPlayerFacebook, etc) for future clarity.

Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
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