3.1.0 • Published 4 years ago
hiro-sdk-scripts v3.1.0
hiro-sdk-scripts
Customized react-scripts package for hiro-sdk-apps
Project setup
Prerequisites
- node 8+
- npm 6+
Commands
create-hiro-sdk-app
==> We should merge this command with hiro-sdk-cli init.
Initializes new HIRO Application without ejecting based on hiro-sdk-cli v1.2.2.
Usage:
npx --package hiro-sdk-scripts create-hiro-sdk-app 'my-app'
- initialize blankmy-app
application.npx --package hiro-sdk-scripts create-hiro-sdk-app 'my-app' -t react
- initialize Reactmy-app
applicaiton.
Advanced usage:
npx --package hiro-sdk-scripts create-hiro-sdk-app 'my-app' -l
- initialize blankmy-app
application and link localhiro-sdk
packagenpx --package hiro-sdk-scripts create-hiro-sdk-app 'my-app' -t react -l
- initialize Reactmy-app
applicaiton and link localhiro-sdk
package
Scripts
Copied from react-scripts v3.3.0 using custom configuration see Customization below.
npm start
npm run build
npm test
npm run eject
Usefull hiro-sdk
command shortcuts, preventing installation of hiro-sdk-cli
:
npm run bundle
=> hiro-sdk-cli bundlenpm run publish
=> hiro-sdk-cli publish -e
Customization
Base: react-scripts v3.3.0
env.js
- remove regex test for prefix "REACTAPP" to allow us to use environment variables without predefined prefix.
webpack.config.prod.js
- Disable chunks
- Remove trailing slash from asset-manifest.json
extend webpack
oneOf
rule to embed all assets. Fixes loading issues of assets loaded by url-loader, caused by missing token.{ test: [ /\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/, /\.ttf$/, /\.svg$/, /\.woff$/, /\.woff2$/, /\.eot$/ ], loader: require.resolve('url-loader'), options: { limit: 250000, name: 'static/media/[name].[hash:8].[ext]', }, },