
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
react-app-rewire-multiple-entry
Advanced tools
React App Rewire Multiple Entry lets you configure multiple entries in Create React App without ejecting.
npm install --save-dev react-app-rewired react-app-rewire-multiple-entry
$ npm install --save-dev react-app-rewired@1.6.2
package.json
"scripts": {
- "start": "react-scripts start",
+ "start": "react-app-rewired start",
- "build": "react-scripts build",
+ "build": "react-app-rewired build",
- "test": "react-scripts test",
+ "test": "react-app-rewired test",
"eject": "react-scripts eject"
}
config-overrides.js
in your React app
directory:// config-overrides.js
const multipleEntry = require('react-app-rewire-multiple-entry')([
{
entry: 'src/entry/landing.js',
template: 'public/landing.html',
outPath: '/landing.html',
omitHash: false,
}
]);
module.exports = {
webpack: function(config, env) {
multipleEntry.addMultiEntry(config);
return config;
}
};
// config-overrides.js
const multipleEntry = require('react-app-rewire-multiple-entry')([
{
entry: 'src/entry/landing.js',
template: 'public/landing.html',
outPath: '/landing.html',
omitHash: false,
}
]);
const {
// addBundleVisualizer,
override,
overrideDevServer
} = require('customize-cra');
module.exports = {
webpack: override(
multipleEntry.addMultiEntry
// addBundleVisualizer()
)
};
// config-overrides.js
const multipleEntry = require('react-app-rewire-multiple-entry')([
{
// Webpack extra entry
entry: 'src/entry/standard.js',
// HTML template used in plugin HtmlWebpackPlugin
template: 'src/entry/standard.html',
// The file to write the HTML to. You can specify a subdirectory
outPath: '/entry/standard.html'
// Visit: http[s]://localhost:3000/entry/standard.html
},
{
entry: 'src/entry/login.js',
// if [template] is empty, Default value: `public/index.html`
// template: 'public/index.html',
outPath: 'public/login.html'
// Visit: http[s]://localhost:3000/public/login.html
},
{
entry: 'src/entry/404.js',
template: 'public/404.html'
// if [outPath] is empty, calculated by `path.relative(process.cwd(), template)` --> `public/404.html`
// outPath: '/public/404.html'
// Visit: http[s]://localhost:3000/public/404.html
},
{
entry: 'src/entry/home.js'
// Default value: `public/index.html`
// template: 'public/index.html',
// Calculated by `path.relative(process.cwd(), template)` --> `public/index.html`
// outPath: '/public/index.html'
// Visit: http[s]://localhost:3000/public/index.html
}
]);
module.exports = {
webpack: function(config, env) {
multipleEntry.addMultiEntry(config);
return config;
}
};
You can pass a array of entry configuration options to react-app-rewire-multiple-entry
, the entry in the array has attributes below:
entry
[Required] Webpack entry JS file. Throw error when empty.template
[Optional] HTML template used in plugin HtmlWebpackPlugin. Default value: public/index.html
.outPath
: [Optional] The file wirte the HTML to. You can specify a subdirectory. If empty, it will be calculated by path.relative(process.cwd(), template)
omitHash
[Optional] Omit the hash for each entry name. Default value: false
, generate hash for entry.addMultiEntry
Inject settings for multiple entry in webpack configThat’s it! Now you can control mulitple entries, enjoy coding!
FAQs
Multiple Entry Support for Create-React-App
The npm package react-app-rewire-multiple-entry receives a total of 4,668 weekly downloads. As such, react-app-rewire-multiple-entry popularity was classified as popular.
We found that react-app-rewire-multiple-entry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.