Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 60a683a

Browse files
authored
fix: esm support (#110)
1 parent c58e723 commit 60a683a

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,13 @@ And then use [`vue-tsc`](https://github.com/johnsoncodehk/volar) to do the type
120120

121121
```ts
122122
// vue.config.js
123+
const ScriptSetup = require('unplugin-vue2-script-setup/webpack').default
123124

124125
module.exports = {
125126
parallel: false, // disable thread-loader, which is not compactible with this plugin
126127
configureWebpack: {
127128
plugins: [
128-
require('unplugin-vue2-script-setup/webpack')({ /* options */ }),
129+
ScriptSetup({ /* options */ }),
129130
],
130131
},
131132
}
@@ -142,11 +143,12 @@ npm i -D @vue/cli-plugin-typescript vue-tsc
142143
```
143144

144145
```ts
146+
const ScriptSetup = require('unplugin-vue2-script-setup/webpack').default
145147
module.exports = {
146148
parallel: false,
147149
configureWebpack: {
148150
plugins: [
149-
require('unplugin-vue2-script-setup/webpack')({ /* options */ }),
151+
ScriptSetup({ /* options */ }),
150152
],
151153
},
152154
chainWebpack(config) {
@@ -175,10 +177,11 @@ And then use [`vue-tsc`](https://github.com/johnsoncodehk/volar) to do the type
175177

176178
```ts
177179
// webpack.config.js
180+
const ScriptSetup = require('unplugin-vue2-script-setup/webpack').default
178181
module.exports = {
179182
/* ... */
180183
plugins: [
181-
require('unplugin-vue2-script-setup/webpack')({ /* options */ }),
184+
ScriptSetup({ /* options */ }),
182185
]
183186
}
184187
```
@@ -209,10 +212,11 @@ export default {
209212
```ts
210213
// esbuild.config.js
211214
import { build } from 'esbuild'
215+
import ScriptSetup from 'unplugin-vue2-script-setup/esbuild'
212216
build({
213217
/* ... */
214218
plugins: [
215-
require('unplugin-vue2-script-setup/esbuild')({
219+
ScriptSetup({
216220
/* options */
217221
}),
218222
],

src/rollup.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
import unplugin from '.'
22

33
export default unplugin.rollup
4-
module.exports = unplugin.rollup
5-
module.exports.default = unplugin.rollup
6-
Object.defineProperty(module.exports, '__esModule', { value: true })

src/vite.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
import unplugin from '.'
22

33
export default unplugin.vite
4-
module.exports = unplugin.vite
5-
module.exports.default = unplugin.vite
6-
Object.defineProperty(module.exports, '__esModule', { value: true })

src/webpack.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
import unplugin from '.'
22

33
export default unplugin.webpack
4-
module.exports = unplugin.webpack
5-
module.exports.default = unplugin.webpack
6-
Object.defineProperty(module.exports, '__esModule', { value: true })

0 commit comments

Comments
 (0)