vite-plugin / vite-plugin-optimizer Goto Github PK
View Code? Open in Web Editor NEWManually Pre-Bundling of Vite
Home Page: https://www.npmjs.com/package/vite-plugin-optimizer
License: MIT License
Manually Pre-Bundling of Vite
Home Page: https://www.npmjs.com/package/vite-plugin-optimizer
License: MIT License
if (typeof config.resolve.alias === 'object') {
config.resolve.alias = Object
.entries(config.resolve.alias)
.reduce((memo, [find, replacement]) => memo.concat({ find, replacement }), []);
}
In your code, when resolve.alias is array,resolve.alias will be inoperative
There are types at 'electron-project/node_modules/vite-plugin-optimizer/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vite-plugin-optimizer' library may need to update its package.json or typings
vite4 require is not defined when this plugin is configured , this is my `vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import optimizer from "vite-plugin-optimizer";
let getReplacer = () => {
let externalModels = ["os", "fs", "path", "events", "child_process", "crypto", "http", "buffer", "url", "better-sqlite3", "knex", "stream"];
let result = {};
for (let item of externalModels) {
result[item] = () => ({
find: new RegExp(`^${item}$`),
code: `const ${item} = require('${item}');export { ${item} as default }`,
});
}
return result;
};
export default defineConfig({
plugins: [
optimizer(getReplacer()),
vue()
],
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.