Skip to content

Commit

Permalink
🔨 [#724] Replace CRA prod build with Vite build
Browse files Browse the repository at this point in the history
dist-vite is now dist, obsoleting the CRA build artifacts.
  • Loading branch information
sergei-maertens committed Jan 6, 2025
1 parent 1f2f4f3 commit 1d43c46
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
29 changes: 0 additions & 29 deletions .babelrc.esm-build

This file was deleted.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,9 @@
},
"scripts": {
"start": "npm run build:design-tokens && vite",
"build": "node scripts/build.js && npm run build:esm",
"build:esm": "rimraf dist/esm && NODE_ENV=production babel --no-babelrc --config-file ./.babelrc.esm-build --ignore 'src/**/*.spec.js','src/**/fixtures/**','src/setupTests.js','src/reportWebVitals.js' src --out-dir dist/esm",
"build:vite": "BUILD_TARGET=umd vite build && BUILD_TARGET=esm vite build",
"build": "BUILD_TARGET=umd vite build && BUILD_TARGET=esm vite build",
"test": "TZ=Europe/Amsterdam vitest",
"test:storybook": "test-storybook --coverage",
"clean": "rimraf dist/*",
"prepare-package": "node scripts/prepare-package.js",
"makemessages-en": "formatjs extract 'src/**/*.{js,jsx}' --format scripts/i18n-formatter.js --out-file src/i18n/messages/en.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'",
"makemessages-nl": "formatjs extract 'src/**/*.{js,jsx}' --format scripts/i18n-formatter.js --out-file src/i18n/messages/nl.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'",
Expand Down
6 changes: 3 additions & 3 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const buildTarget = process.env.BUILD_TARGET || 'umd';
* - the react-intl translations are not distributed yet (also broken in CRA/babel build!)
*/
const esmOutput = {
dir: 'dist-vite/esm',
dir: 'dist/esm',
format: 'esm',
preserveModules: true,
preserveModulesRoot: 'src',
Expand All @@ -51,7 +51,7 @@ const esmOutput = {
* @todo - optimize with bundle splitting/chunk management.
*/
const umdOutput = {
dir: 'dist-vite',
dir: 'dist',
format: 'umd',
exports: 'named',
name: 'OpenForms',
Expand Down Expand Up @@ -91,7 +91,7 @@ export default defineConfig({
assetsInlineLimit: 8 * 1024, // 8 KiB
cssCodeSplit: false,
sourcemap: buildTarget !== 'esm',
outDir: 'dist-vite/umd',
outDir: 'dist/umd',
rollupOptions: {
input: 'src/sdk.jsx',
// do not externalize anything in UMD build - bundle everything
Expand Down

0 comments on commit 1d43c46

Please sign in to comment.