-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#203 applies additional changes for Vite migration
- Loading branch information
1 parent
bdc8eb0
commit 5b9e59e
Showing
18 changed files
with
189 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
.eslintcache | ||
.stylelintcache | ||
report.*.json | ||
/stats/ | ||
|
||
# IntelliJ project files | ||
.idea | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 was deleted.
Oops, something went wrong.
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,2 @@ | ||
export { default as options } from './styleguide/options'; | ||
export { default as plugins } from './styleguide/plugins'; |
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,9 @@ | ||
import app from '@/styleguide/components/app.vue'; | ||
import '@/styleguide/api/browser'; | ||
|
||
export default { | ||
template: '<app />', | ||
components: { | ||
app, | ||
}, | ||
}; |
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,11 @@ | ||
import { createRouter, createWebHistory } from 'vue-router'; | ||
import styleguideRoutes from './routes'; | ||
|
||
const router = createRouter({ | ||
routes: styleguideRoutes, | ||
history: createWebHistory(), | ||
}); | ||
|
||
export default [ | ||
[router], | ||
]; |
File renamed without changes.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* eslint-disable */ | ||
declare module '*.vue' { | ||
import type { DefineComponent } from 'vue' | ||
const component: DefineComponent<{}, {}, any> | ||
export default component | ||
import type { DefineComponent } from 'vue'; | ||
|
||
const component: DefineComponent<{}, {}, any>; // eslint-disable-line | ||
|
||
export default component; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,69 @@ | ||
import { defineConfig } from 'vite'; | ||
import { defineConfig, splitVendorChunkPlugin } from 'vite'; | ||
import vue from '@vitejs/plugin-vue' | ||
import path from 'path'; | ||
import { webpack } from './package.json'; // TODO: rename config property in package.json. | ||
import { visualizer } from 'rollup-plugin-visualizer'; | ||
|
||
export default defineConfig({ | ||
plugins: [vue()], | ||
resolve: { | ||
alias: { | ||
'@': path.resolve(__dirname, 'src/'), | ||
} | ||
}, | ||
define: { | ||
// Was required to get rid of esm build warning for Vue-i18n. | ||
// @see https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags | ||
__VUE_I18N_FULL_INSTALL__: true, | ||
__VUE_I18N_LEGACY_API__: false, | ||
}, | ||
export default defineConfig(({ command, mode }) => { | ||
const config = { | ||
plugins: [ | ||
vue(), | ||
splitVendorChunkPlugin(), | ||
], | ||
resolve: { | ||
alias: { | ||
'@': path.resolve(__dirname, 'src/'), | ||
} | ||
}, | ||
define: { | ||
// Was required to get rid of esm build warning for Vue-i18n. | ||
// @see https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags | ||
__VUE_I18N_FULL_INSTALL__: true, | ||
__VUE_I18N_LEGACY_API__: false, | ||
}, | ||
} | ||
|
||
switch(command) { | ||
case 'build': // @see https://vitejs.dev/config/build-options.html | ||
config.base = webpack.productionPath; // TODO: rename to buildBase. | ||
config.build = { | ||
outDir: webpack.buildPath, // TODO: rename to 'buildOutDir' | ||
assetsDir: webpack.outputAssetsFolder, // TODO: rename to 'buildAssetsDir'. | ||
assetsInlineLimit: 0, // TODO: check if it makes sense to increase this value. | ||
manifest: true, | ||
emptyOutDir: true, | ||
copyPublicDir: true, | ||
// TODO: watch? | ||
rollupOptions: { | ||
output: { | ||
assetFileNames: (assetInfo) => { | ||
const extType = assetInfo.name.split('.').at(1); | ||
let path = 'assets' | ||
|
||
if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) { | ||
path += '/img'; | ||
} else if (/css|sass|scss/i.test(extType)) { | ||
path += '/css'; | ||
} else if (/woff|woff2|eot|ttf|otf/i.test(extType)) { | ||
path += '/fonts'; | ||
} | ||
|
||
return `${path}/[name][extname]`; | ||
}, | ||
} | ||
}, | ||
} | ||
|
||
if (mode === 'profile') { | ||
config.plugins.push( | ||
visualizer({ // NOTE: the sizes reported by this plugin relate to the source, not build size... @see https://github.com/btd/rollup-plugin-visualizer/issues/96 | ||
filename: "./stats/index.html", | ||
open: true, | ||
template: 'treemap', | ||
}) | ||
) | ||
} | ||
} | ||
|
||
return config; | ||
}); |