-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8317 from marmelab/demo-vitz
[Demo] Move e-commerce demo from webpack to vite
- Loading branch information
Showing
11 changed files
with
905 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,6 @@ | |
}, | ||
"include": [ | ||
"src" | ||
] | ||
], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { defineConfig } from 'vite'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
const packages = fs.readdirSync(path.resolve(__dirname, '../../packages')); | ||
const aliases = packages.reduce((acc, dirName) => { | ||
const packageJson = require(path.resolve( | ||
__dirname, | ||
'../../packages', | ||
dirName, | ||
'package.json' | ||
)); | ||
acc[packageJson.name] = path.resolve( | ||
__dirname, | ||
`${path.resolve('../..')}/packages/${packageJson.name}/src` | ||
); | ||
return acc; | ||
}, {}); | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
define: { | ||
'process.env': process.env, | ||
}, | ||
server: { | ||
port: 8000, | ||
}, | ||
base: './', | ||
esbuild: { | ||
keepNames: true, | ||
}, | ||
build: { | ||
sourcemap: true, | ||
}, | ||
resolve: { | ||
preserveSymlinks: true, | ||
alias: [ | ||
// allow profiling in production | ||
{ find: 'react-dom', replacement: 'react-dom/profiling' }, | ||
{ | ||
find: 'scheduler/tracing', | ||
replacement: 'scheduler/tracing-profiling', | ||
}, | ||
// we need to manually follow the symlinks for local packages to allow deep HMR | ||
...Object.keys(aliases).map(packageName => ({ | ||
find: packageName, | ||
replacement: aliases[packageName], | ||
})), | ||
], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.