onesky-conductor-webpack-plugin-staging v0.0.3
onesky-conductor-webpack-plugin
Outside the web app, retrieve string files for the web app via App API). It is a plugin which is running in compile time
Configure your onesky-conductor-webpack-plugin
Install
npm i onesky-conductor-webpack-plugin-staging
npm npm install react-app-rewired --save-dev
Adjust your Webpack Config
Now create a specially-named file, config-overrides.js
in your project’s root directory. Therein, react-app-rewired is going to give you access to the original webpack config. You can mutate it, always a good idea, and send it back to work in create-react-app. You might add support for CSS modules:
config-overrides.js
const OneSkyConductorPlugin = require('onesky-conductor-webpack-plugin');
module.exports = (config, env) => {
config.plugins.push(
new OneSkyConductorPlugin ({
appId: 'cfad03c9-0071-4de4-a58c-71a0d4cd9f31',
fileFormat: 'json',
stringFilePath: '../react-example-app/build/locales'
}),
)
return config
}
Adjust your npm-scripts
Finally, to bypass the create-react-app scripts entry point, we are going to use some scripts provided by react-app-rewired. In package.json
, change start
, build
and test
to be:
{
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom"
}
}
NPM
Now running npm start
or npm run build
will engage your franken-config.
Yarn
Now running yarn run
or yarn build
will engage your franken-config.