Skip to content

Commit 6872cc5

Browse files
Bump to Vite 4 and adding lib name
1 parent fe80c29 commit 6872cc5

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

vite.config.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
const path = require('path')
1+
import { resolve } from 'path'
2+
import { defineConfig } from 'vite'
23

3-
module.exports = {
4-
build: {
5-
lib: {
6-
entry: path.resolve(__dirname, 'src/index.ts'),
7-
name: 'stimulus-rails-nested-form'
8-
},
9-
rollupOptions: {
10-
external: ['stimulus'],
11-
output: {
12-
globals: {
13-
stimulus: 'Stimulus'
4+
export default defineConfig(({ mode }) => {
5+
if (mode === 'netlify') {
6+
return {}
7+
}
8+
9+
return {
10+
build: {
11+
lib: {
12+
entry: resolve(__dirname, 'src/index.ts'),
13+
name: 'StimulusRailsNestedForm',
14+
fileName: 'stimulus-rails-nested-form'
15+
},
16+
rollupOptions: {
17+
external: ['@hotwired/stimulus'],
18+
output: {
19+
globals: {
20+
'@hotwired/stimulus': 'Stimulus'
21+
}
1422
}
1523
}
1624
}
1725
}
18-
}
26+
})

0 commit comments

Comments
 (0)