@ebay/muse-setup-cra
v1.1.2
Published
Config an empty create-react-app application to be a Muse plugin project.
Maintainers
Keywords
Readme
muse-setup-cra
Config an empty create-react-app application to be a Muse plugin project.
- Install Muse dependencies
- @craco/craco
- @ebay/muse-core
- @ebay/muse-cra-patch
- @ebay/muse-craco-plugin
- @ebay/muse-lib-react
- Update
package.jsonto have muse config
"muse": {
"devConfig": {
"app": "myapp",
"env": "staging"
},
"type": "normal"
}- Update scripts in
package.json
"scripts": {
"start": "muse-cra-patch && cross-env PORT=3033 craco start",
"build": "muse-cra-patch && craco build",
"build:dev": "muse-cra-patch && cross-env NODE_ENV=development FAST_REFRESH=false craco build",
"build:test": "muse-cra-patch && cross-env MUSE_TEST_BUILD=true FAST_REFRESH=false craco build",
"prestart": "muse-ebay-dev check-updates",
"prebuild": "muse-ebay-dev check-updates",
}- Add
craco.config.js
const MuseCracoPlugin = require('@ebay/muse-craco-plugin');
module.exports = () => {
return {
plugins: [{ plugin: MuseCracoPlugin }],
};
};- Update
src/index.jsto be a Muse entry file
import plugin from 'js-plugin';
import * as ext from './ext';
import route from './route';
import reducer from './reducer';
plugin.register({
...ext,
name: 'myplugin', // The plugin name same with which in package.json
route,
reducer,
});- Delete
public/index.html
