Fix build

pull/2413/head
Jérémy Rialland 2022-11-22 12:12:17 +01:00 committed by Jérémy Rialland
parent b5ba6eae93
commit 10b39c2dd8
4 changed files with 26 additions and 5 deletions

View File

@ -10,6 +10,7 @@
"license": "MIT",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"test": "vitest",

View File

@ -2,8 +2,9 @@
"compilerOptions": {
/* Basic Options */
"incremental": true,
"target": "ES2020",
"target": "ESNext",
"module": "NodeNext",
"rootDir": "./",
"outDir": "dist",
"declaration": true,
@ -30,11 +31,14 @@
"resolveJsonModule": true,
/* Advanced Options */
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
// remove this when vite support "NodeNext" : https://github.com/vitejs/vite/issues/10481 or https://github.com/vitejs/vite/issues/8993
"skipLibCheck": true
},
"ts-node": {
"esm": true
},
"include": ["source"],
"exclude": ["**/node_modules", "**/dist", "vitest.config.ts"]
"include": ["source", "vitest.config.ts"],
"exclude": ["**/dist"]
}

View File

@ -24,7 +24,7 @@
"start:axe-debugging": "VITE_AXE_CORE_ENABLED=true vite dev",
"start:netlify": "sed 's|:SITE_EN|/infrance|g' netlify.base.toml | sed 's|:SITE_FR|/mon-entreprise|g' | sed 's|:API_URL|http://localhost:3004|g' | sed 's|\\[\\[redirects\\]\\]|\\[\\[redirects\\]\\]\\n force = true|g' > netlify.toml && HMR_CLIENT_PORT=8888 netlify dev",
"build": "NODE_OPTIONS='--max-old-space-size=6144'; yarn build:sitemap && vite build && yarn build:iframe-script",
"build:ssr": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --ssr ./source/entry-server.tsx --outDir ./dist/ssr --emptyOutDir && echo '{\"module\": \"commonjs\"}' > dist/package.json",
"build:ssr": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --ssr ./source/entry-server.tsx --outDir ./dist/ssr --emptyOutDir && echo '{\"type\": \"module\"}' > dist/package.json",
"build:prerender": "ts-node-esm prerender.ts",
"build:iframe-script": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --config vite-iframe-script.config.ts",
"build:sitemap": "ts-node-esm scripts/build-sitemap.ts",

View File

@ -119,6 +119,22 @@ export default defineConfig(({ command, mode }) => ({
// Optimize cjs deps from publicodes
include: ['publicodes > moo', 'publicodes > nearley'],
},
ssr: {
/**
* Prevent listed dependencies from being externalized for SSR build cause some
* packages are not esm ready or package.json setup seems wrong, wait this pr to be merge:
* react-spectrum: https://github.com/adobe/react-spectrum/pull/3630
* markdown-to-jsx: https://github.com/probablyup/markdown-to-jsx/pull/414
* styled-components: https://github.com/styled-components/styled-components/issues/3601
* publicodes-react: Add type module
*/
noExternal: [
/react-aria|react-stately|internationalized/,
/markdown-to-jsx/,
/styled-components|emotion/,
/publicodes-react/, // TODO remove this after publicodes-react upgrade
],
},
}))
type MultipleSPAOptions = {