Skip to content

Commit

Permalink
πŸ”§(react) migrate to vite 6
Browse files Browse the repository at this point in the history
With the new major version of vite, some path resolution did not work so
we update our vite config to resolve properly paths starting by 'src'.
Furthermore there were some deprecation warning about the use of cjs
files as vite configuration so we use 'mts' extension for all vite
config files in react package to allow vite to detect them as
ES Modules.
  • Loading branch information
jbpenrath committed Jan 8, 2025
1 parent afe05ec commit 86815cf
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/react/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module.exports = {
{
devDependencies: [
"vite.config.ts",
"vite.icons.config.ts",
"vite.fonts.config.ts",
"vite.icons.config.mts",
"vite.fonts.config.mts",
"cunningham.ts",
"**/*.stories.tsx",
"**/*.spec.tsx",
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"build": "bash ./build",
"build:watch": "yarn build && vite build --mode watch",
"build:watch-polling": "yarn build && vite build --mode watch-polling",
"build-fonts": "vite build -c vite.fonts.config.ts && rm -rf dist/fonts.js && make-dir dist/sass && cp src/fonts.scss dist/sass/",
"build-icons": "vite build -c vite.icons.config.ts && rm -rf dist/icons.js && make-dir dist/sass && cp src/icons.scss dist/sass/",
"build-fonts": "vite build -c vite.fonts.config.mts && rm -rf dist/fonts.js && make-dir dist/sass && cp src/fonts.scss dist/sass/",
"build-icons": "vite build -c vite.icons.config.mts && rm -rf dist/icons.js && make-dir dist/sass && cp src/icons.scss dist/sass/",
"build-theme": "cunningham -o src -g css,ts,js,scss",
"preview": "vite preview",
"test": "cross-env FORCE_COLOR=1 vitest run",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Forms/Select/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use 'src/utils' as *;;
@use 'src/utils' as *;

.c__select {
position: relative;
Expand Down
5 changes: 5 additions & 0 deletions packages/react/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default defineConfig(({ mode }) => {
index: "./src/index.ts",
},
formats: ["es", "cjs"],
cssFileName: 'style'
},
rollupOptions: {
external: ["react", "react-dom"],
Expand Down Expand Up @@ -84,6 +85,10 @@ export default defineConfig(({ mode }) => {
find: ":",
replacement: resolve(__dirname, "./src"),
},
{
find: "src",
replacement: resolve(__dirname, "./src"),
}
],
},
};
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 86815cf

Please sign in to comment.