canopy-sofe-extensions
canopy-sofe-extensions is an npm package that is part of canopy common dependencies. It does two things:
- Provides special sofe overrides of
integ
, stage
, prod
, or simply a port number (for localhost) - Exports a function,
calculatePublicPath
, that helps you set the webpack public path for a sofe override correctly. Setting
the public path correctly is required for doing code splitting in a sofe service.
Example usage
import {calculatePublicPath} from 'canopy-sofe-extensions'
__webpack_public_path__ = calculatePublicPath("name-of-my-sofe-service")
If you need to call dynamic import()
immediately in a file that gets executed before the entry file, try the following
import './set-public-path.js'
import {calculatePublicPath} from 'canopy-sofe-extensions'
__webpack_public_path__ = calculatePublicPath("name-of-my-sofe-service")