-
-
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 #9565 from marmelab/upgrade-vite
Upgrade vite dependencies
- Loading branch information
Showing
12 changed files
with
658 additions
and
504 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 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import react from '@vitejs/plugin-react'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import { defineConfig } from 'vite'; | ||
|
||
/** | ||
* https://vitejs.dev/config/ | ||
* @type { import('vite').UserConfig } | ||
*/ | ||
export default defineConfig(async () => { | ||
// In codesandbox, we won't have the packages folder | ||
// We ignore errors in this case | ||
let aliases: any[] = []; | ||
try { | ||
const packages = fs.readdirSync( | ||
path.resolve(__dirname, '../../packages') | ||
); | ||
for (const dirName of packages) { | ||
if (dirName === 'create-react-admin') continue; | ||
// eslint-disable-next-line prettier/prettier | ||
const packageJson = await import( | ||
path.resolve(__dirname, '../../packages', dirName, 'package.json'), | ||
{ assert: { type: 'json' } } | ||
); | ||
aliases.push({ | ||
find: new RegExp(`^${packageJson.default.name}$`), | ||
replacement: path.resolve( | ||
__dirname, | ||
`../../packages/${packageJson.default.name}/src` | ||
), | ||
}); | ||
} | ||
} catch { | ||
} | ||
|
||
return { | ||
plugins: [react()], | ||
resolve: { | ||
alias: [ | ||
...aliases, | ||
{ | ||
find: /^@mui\/icons-material\/(.*)/, | ||
replacement: '@mui/icons-material/esm/$1', | ||
}, | ||
], | ||
}, | ||
server: { | ||
port: 8080, | ||
}, | ||
define: { 'process.env': {} }, | ||
}; | ||
}); |
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
Oops, something went wrong.