Skip to content

Commit

Permalink
WEB-2001 update build config
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Ladaria committed Aug 27, 2024
1 parent 1f34412 commit 8021a0b
Show file tree
Hide file tree
Showing 28 changed files with 266 additions and 298 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
"@types/rimraf": "^3.0.2",
"@types/semver-compare": "^1.0.1",
"@types/webpack-env": "^1.18.4",
"@vanilla-extract/jest-transform": "^1.1.5",
"@vanilla-extract/vite-plugin": "^3.9.5",
"@vanilla-extract/webpack-plugin": "^2.3.9",
"@vanilla-extract/jest-transform": "^1.1.9",
"@vanilla-extract/vite-plugin": "^4.0.15",
"@vanilla-extract/webpack-plugin": "^2.3.13",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.12",
"axe-html-reporter": "^2.2.3",
Expand Down Expand Up @@ -161,9 +161,9 @@
"@juggle/resize-observer": "^3.3.1",
"@tef-novum/webview-bridge": "^3.27.0",
"@telefonica/libphonenumber": "^2.9.0",
"@vanilla-extract/css": "^1.15.2",
"@vanilla-extract/dynamic": "^2.1.1",
"@vanilla-extract/sprinkles": "^1.6.2",
"@vanilla-extract/css": "^1.15.5",
"@vanilla-extract/dynamic": "^2.1.2",
"@vanilla-extract/sprinkles": "^1.6.3",
"classnames": "^2.3.1",
"lottie-react": "^2.4.0",
"moment": "^2.30.1",
Expand Down
15 changes: 13 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import {execSync} from 'node:child_process';
import {compile} from './compile.js';
import {existsSync} from 'node:fs';

const run = (command) => {
execSync(command, {stdio: 'inherit'});
const run = (command, {stdio = 'inherit'} = {}) => {
execSync(command, {stdio});
};

const checkBuild = () => {
if (existsSync('./dist/node_modules')) {
console.log('ERROR: "dist/node_modules" exists. Check "vite.config.js" external config.');
process.exit(1);
}
};

(async () => {
Expand All @@ -11,4 +19,7 @@ const run = (command) => {

console.log('Generating TS defs...');
run('yarn gen-ts-defs');

console.log('Check build');
checkBuild();
})();
15 changes: 13 additions & 2 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import react from '@vitejs/plugin-react';
import {vanillaExtractPlugin} from '@vanilla-extract/vite-plugin';
import noBundlePlugin from 'vite-plugin-no-bundle';
import preserveDirectivesPlugin from 'rollup-plugin-preserve-directives';
import packageJson from './package.json';

export default defineConfig({
plugins: [
Expand Down Expand Up @@ -40,8 +41,18 @@ export default defineConfig({
}
handler(level, log);
},
// otherwise, all external dependencies are included in the "./dist" folder
external: [/\/node_modules\//],
// otherwise, all dependencies are included in a "node_modules" folder inside "./dist"
external: [
...Object.keys(packageJson.dependencies),
...Object.keys(packageJson.peerDependencies),
'react/jsx-runtime',
'moment/locale/de.js',
'moment/locale/es.js',
'moment/locale/en-gb.js',
'moment/locale/pt-br.js',
'moment/moment.js',
'@vanilla-extract/sprinkles/createRuntimeSprinkles',
],
},
},
});
Loading

0 comments on commit 8021a0b

Please sign in to comment.