mirror of
https://github.com/ershisan99/bundlers-demo.git
synced 2025-12-16 12:32:56 +00:00
add build config
This commit is contained in:
10
package.json
10
package.json
@@ -2,10 +2,16 @@
|
||||
"name": "bundlers",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
"type": "module",
|
||||
"types": "./dist/index.d.ts",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"/dist",
|
||||
"/dist/style.css"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "storybook dev -p 6006",
|
||||
"build": "tsc && vite build",
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
"include": ["vite.config.ts", "package.json"]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,35 @@
|
||||
import { resolve } from 'path'
|
||||
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
import { dependencies, devDependencies, peerDependencies } from './package.json'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
build: {
|
||||
lib: {
|
||||
// Could also be a dictionary or array of multiple entry points
|
||||
entry: resolve(__dirname, 'src/index.ts'),
|
||||
// the proper extensions will be added
|
||||
fileName: 'index',
|
||||
formats: ['es'],
|
||||
name: 'bundlers',
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [
|
||||
...Object.keys(peerDependencies),
|
||||
...Object.keys(dependencies),
|
||||
...Object.keys(devDependencies),
|
||||
],
|
||||
output: {
|
||||
dir: 'dist',
|
||||
entryFileNames: '[name].js',
|
||||
format: 'es',
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
target: 'esnext',
|
||||
},
|
||||
plugins: [react()],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user