-
Notifications
You must be signed in to change notification settings - Fork 8
Replace rollup with vite configuration #1364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
0349072
2a0cfa9
167f2f3
4861a7e
a72fb14
4337e43
c3fdade
070817a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import { defineConfig } from 'vite'; | ||
| import { createHtmlPlugin } from 'vite-plugin-html'; | ||
| import babel from 'vite-plugin-babel'; | ||
| import { VitePWA } from 'vite-plugin-pwa'; | ||
| import { viteStaticCopy } from 'vite-plugin-static-copy'; | ||
|
|
||
| export default defineConfig({ | ||
| build: { | ||
| rollupOptions: { | ||
| output: { | ||
| entryFileNames: '[hash].js', | ||
| chunkFileNames: '[hash].js', | ||
| assetFileNames: '[hash][extname]', | ||
| }, | ||
| onwarn: (warning, warn) => { | ||
| if (warning.code === 'THIS_IS_UNDEFINED') return; | ||
| warn(warning); | ||
| }, | ||
| }, | ||
| target: 'es2021', | ||
| minify: 'terser', | ||
| emptyOutDir: false, | ||
| }, | ||
| plugins: [ | ||
| /** Copy static assets */ | ||
| viteStaticCopy({ | ||
| targets: [ | ||
| { src: 'src/assets', dest: 'src' }, | ||
| ], | ||
| }), | ||
| /** HTML Plugin with service worker injection */ | ||
| createHtmlPlugin({ | ||
| minify: true, | ||
| inject: { | ||
| data: { | ||
| }, | ||
| }, | ||
| }), | ||
| /** Babel Plugin for JS transpilation */ | ||
| babel({ | ||
| babelConfig: { | ||
| presets: [ | ||
| [ | ||
| '@babel/preset-env', | ||
| { | ||
| targets: [ | ||
| 'last 3 Chrome major versions', | ||
| 'last 3 Firefox major versions', | ||
| 'last 3 Edge major versions', | ||
| 'last 3 Safari major versions', | ||
| ], | ||
| modules: false, | ||
| bugfixes: true, | ||
| }, | ||
| ], | ||
| ], | ||
| plugins: [ | ||
| [ | ||
| 'babel-plugin-template-html-minifier', | ||
| { | ||
| modules: { lit: ['html', { name: 'css', encapsulation: 'style' }] }, | ||
| failOnError: false, | ||
| strictCSS: true, | ||
| htmlMinifier: { | ||
| collapseWhitespace: true, | ||
| conservativeCollapse: true, | ||
| removeComments: true, | ||
| caseSensitive: true, | ||
| minifyCSS: true, | ||
| }, | ||
| }, | ||
| ], | ||
| ], | ||
| }, | ||
| }), | ||
| /** PWA Plugin for service worker generation */ | ||
| VitePWA({ | ||
| registerType: 'autoUpdate', | ||
| strategies: 'generateSW', | ||
| workbox: { | ||
| globDirectory: 'dist', | ||
| globPatterns: ['**/*.{html,js,css,webmanifest}'], | ||
| globIgnores: ['polyfills/*.js', 'nomodule-*.js'], | ||
| navigateFallback: '/index.html', | ||
| runtimeCaching: [ | ||
| { | ||
| urlPattern: /^polyfills\/.*\.js$/, | ||
| handler: 'CacheFirst', | ||
| }, | ||
| ], | ||
| maximumFileSizeToCacheInBytes: 5 * 1024 * 1024 | ||
| }, | ||
| }), | ||
| ], | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
| }, | ||
| "scripts": { | ||
| "start": "tsc && concurrently -k -r \"tsc --watch\" \"wds\"", | ||
| "build": "rimraf dist && tsc && node --max-old-space-size=4096 node_modules/rollup/dist/bin/rollup -c rollup.config.mjs", | ||
| "build": "rimraf dist && tsc && node --max-old-space-size=4096 node_modules/vite/bin/vite.js build", | ||
|
||
| "start:build": "web-dev-server --root-dir dist --app-index index.html --open", | ||
| "lint": "eslint \"**/*.{js,ts}\" --ignore-path .gitignore", | ||
| "test": "tsc --project tsconfig.test.json && wtr" | ||
|
|
@@ -30,34 +30,30 @@ | |
| "igniteui-webcomponents-grids": "~5.0.0", | ||
| "igniteui-webcomponents-inputs": "~5.0.0", | ||
| "igniteui-webcomponents-layouts": "~5.0.0", | ||
| "lit": "^3.1.2", | ||
| "typescript": "~5.5.4" | ||
| "lit": "^3.2.1", | ||
| "typescript": "~5.7.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/preset-env": "^7.20.2", | ||
| "@open-wc/building-rollup": "^2.2.1", | ||
| "@open-wc/testing": "^4.0.0", | ||
| "@rollup/plugin-babel": "^6.0.3", | ||
| "@rollup/plugin-node-resolve": "^15.0.1", | ||
| "@typescript-eslint/eslint-plugin": "^7.13.1", | ||
| "@typescript-eslint/parser": "^7.13.1", | ||
| "@web/dev-server": "^0.4.6", | ||
| "@web/rollup-plugin-html": "^2.3.0", | ||
| "@web/rollup-plugin-import-meta-assets": "^1.0.7", | ||
| "@web/test-runner": "^0.18.0", | ||
| "babel-plugin-template-html-minifier": "^4.1.0", | ||
| "concurrently": "^8.2.2", | ||
| "concurrently": "^9.1.2", | ||
| "deepmerge": "^4.2.2", | ||
| "eslint": "^8.57.0", | ||
| "eslint-plugin-lit": "^1.8.2", | ||
| "igniteui-cli": "^14.0.0", | ||
| "rimraf": "^5.0.5", | ||
| "rollup": "^2.79.0", | ||
| "rollup-plugin-copy-assets": "^2.0.3", | ||
| "rollup-plugin-terser": "^7.0.2", | ||
| "rollup-plugin-workbox": "^8.1.0", | ||
| "rimraf": "^5.0.10", | ||
| "source-map": "^0.7.4", | ||
| "tslib": "^2.6.2", | ||
| "@types/mocha": "^10.0.6" | ||
| "tslib": "^2.8.1", | ||
| "@types/mocha": "^10.0.6", | ||
| "vite": "^6.0.7", | ||
| "vite-plugin-pwa": "^0.21.1", | ||
| "vite-plugin-static-copy": "^2.2.0", | ||
| "vite-plugin-babel": "^1.3.0", | ||
| "vite-plugin-html": "^3.2.2" | ||
| } | ||
| } | ||

Uh oh!
There was an error while loading. Please reload this page.