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

[Question] What about code splitting in vendors? #38

Closed
chemitaxis opened this issue May 25, 2017 · 2 comments
Closed

[Question] What about code splitting in vendors? #38

chemitaxis opened this issue May 25, 2017 · 2 comments

Comments

@chemitaxis
Copy link

Hi, I'm using this in my projects, but I want to use create-react-app.


// optimizations
    new CommonsChunkPlugin({
      children: true,
      async: 'common',
      minChunks: 2,
    }),
    new CommonsChunkPlugin({
      children: true,
      async: 'vendor',
      minChunks(module) {
        // this assumes your vendor imports exist in the node_modules directory
        return isVendor(module);
      },
    }),

Where isVendor is like this:

function isVendor (module) {
  return module.context && module.context.indexOf('node_modules') !== -1;
}

Can I use react-app-rewired for this? Thanks ;)

@timarney
Copy link
Owner

To date I haven't heard of anyone who has tried splitting out vendors using this repo.

I would suggest looking at these issues in the CRA repo first:
facebook/create-react-app#2206
facebook/create-react-app#2310

@chemitaxis
Copy link
Author

Perfect, thanks!

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