refactor: update to not bundle but instead chunk using vite-plugin-no-bundle

This commit is contained in:
Derrick Hammer 2023-10-09 14:28:09 -04:00
parent 223cc991a2
commit 514a134203
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 20 additions and 9 deletions

11
npm-shrinkwrap.json generated
View File

@ -62,6 +62,7 @@
"uniqid": "^5.4.0",
"vite": "^4.4.11",
"vite-plugin-dts": "^3.6.0",
"vite-plugin-no-bundle": "^3.0.0",
"vite-plugin-node-polyfills": "^0.15.0",
"vite-plugin-optimizer": "^1.4.2",
"vite-plugin-scope-tailwind": "^1.1.3",
@ -28204,6 +28205,16 @@
}
}
},
"node_modules/vite-plugin-no-bundle": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/vite-plugin-no-bundle/-/vite-plugin-no-bundle-3.0.0.tgz",
"integrity": "sha512-B8O4ZmWHbA8MWhsCqjcxwCLW5Kk2Q1Ax7JhZBBB/ort+DNONkBA2HND0d9lQ5d0Q+JSOMYAQDDQ1qAS1nmThyA==",
"dev": true,
"dependencies": {
"fast-glob": "^3.2.12",
"micromatch": "^4.0.5"
}
},
"node_modules/vite-plugin-node-polyfills": {
"version": "0.15.0",
"resolved": "https://registry.npmjs.org/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.15.0.tgz",

View File

@ -2,8 +2,7 @@
"name": "@lumeweb/sdk",
"version": "0.1.0-develop.3",
"type": "module",
"main": "lib/lib.umd.js",
"module": "lib/lib.es.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
@ -74,6 +73,7 @@
"uniqid": "^5.4.0",
"vite": "^4.4.11",
"vite-plugin-dts": "^3.6.0",
"vite-plugin-no-bundle": "^3.0.0",
"vite-plugin-node-polyfills": "^0.15.0",
"vite-plugin-optimizer": "^1.4.2",
"vite-plugin-scope-tailwind": "^1.1.3",

View File

@ -4,8 +4,8 @@ import scopeTailwind from "vite-plugin-scope-tailwind";
import { resolve } from "path";
import svgr from "vite-plugin-svgr";
import dts from "vite-plugin-dts";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import optimizer from "vite-plugin-optimizer";
import noBundlePlugin from "vite-plugin-no-bundle";
// https://vitejs.dev/config/
export default defineConfig({
@ -20,11 +20,7 @@ export default defineConfig({
"node-fetch":
"const e = undefined; export default e;export {e as Response, e as FormData, e as Blob};",
}),
nodePolyfills({
exclude: ["fs"],
globals: { Buffer: true, global: true, process: true },
}),
// css({ output: 'styles/globals.css' })
noBundlePlugin(),
],
resolve: {
dedupe: ["@lumeweb/libportal", "@lumeweb/libweb", "@lumeweb/libkernel"],
@ -45,9 +41,13 @@ export default defineConfig({
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "sdk",
fileName: (format) => `lib.${format}.js`,
fileName: "index",
formats: ["es"],
},
rollupOptions: {
output: {
inlineDynamicImports: false,
},
external: ["react", "react-dom"],
},
},