Skip to content

code chunking impossible as application.js imports every component #727

Closed
@krazyjakee

Description

@krazyjakee
  • I have another issue to discuss.

The app is large. I use code chunking like this...

shared.js

new webpack.optimize.CommonsChunkPlugin({
      names: ['common'],
      chunks: [
        "components/a",
        "components/b",
        "components/c",
        "components/d",
        "components/e"
      ],
      minChunks: Infinity
    })

The application.js looks like this: https://github.com/reactjs/react-rails/blob/master/lib/generators/templates/server_rendering_pack.js

The common and chunks appear to be working correctly but are useless as application.js already loaded them all. If I comment out the context, react_ujs cannot find the components loaded in the common chunk.

application.js

// var componentRequireContext = require.context("components", true)
var ReactRailsUJS = require("react_ujs")
// ReactRailsUJS.useContext(componentRequireContext)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions