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

Website: Document dynamic code splitting with Webpack #167

Closed
1 task done
clebert opened this issue Dec 11, 2018 · 0 comments
Closed
1 task done

Website: Document dynamic code splitting with Webpack #167

clebert opened this issue Dec 11, 2018 · 0 comments
Assignees
Milestone

Comments

@clebert
Copy link
Member

clebert commented Dec 11, 2018

Out of date

Dynamic Code Splitting With Webpack

Feature apps can use
webpack's dynamic code splitting feature
using the import() syntax.

To make this work for multiple feature apps living together on the Feature Hub
two configurations need to be made:

  1. Set a unique value for
    output.jsonpFunction,
    e.g. "webpackJsonpMyFeatureApp".

  2. Set
    output.publicPath
    to the public URL (relative or absolute) of the output directory, i.e. where
    all the feature app chunks are hosted.

    Since this is not always known at compile time, it can be left blank and set
    dynamically at runtime in the feature app's entry file using the global
    variable __webpack_public_path__. To help with that, createInstance is
    called with an env object that includes the publicPath of the feature
    app:

    export const featureApp = {
    	id,
    	dependencies,
    
    	createInstance(env) {
    		__webpack_public_path__ = env.publicPath;
    
    		return {
    			kind: 'react',
    			render: () => <div>Foo</div>,
    			isCompleted: () => true
    		};
    	}
    };
@clebert clebert added this to the Backlog milestone Dec 14, 2018
@clebert clebert changed the title Document dynamic code splitting with Webpack Website: Document dynamic code splitting with Webpack Dec 30, 2018
@clebert clebert modified the milestones: Backlog, Website Dec 30, 2018
@clebert clebert self-assigned this Dec 30, 2018
clebert added a commit that referenced this issue Jan 2, 2019
Closes #119, #167, #189, #151, #138, #145, #146

This commit replaces the large README and scattered package READMEs. In the future, the WebSite will be the gateway to documentation. GitHub will then only be used for development/collaboration.
@clebert clebert closed this as completed Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant