Skip to content

Commit

Permalink
fix: esm support (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiangmoe committed Feb 11, 2022
1 parent c58e723 commit 60a683a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,13 @@ And then use [`vue-tsc`](https://github.com/johnsoncodehk/volar) to do the type

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

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

```ts
const ScriptSetup = require('unplugin-vue2-script-setup/webpack').default
module.exports = {
parallel: false,
configureWebpack: {
plugins: [
require('unplugin-vue2-script-setup/webpack')({ /* options */ }),
ScriptSetup({ /* options */ }),
],
},
chainWebpack(config) {
Expand Down Expand Up @@ -175,10 +177,11 @@ And then use [`vue-tsc`](https://github.com/johnsoncodehk/volar) to do the type

```ts
// webpack.config.js
const ScriptSetup = require('unplugin-vue2-script-setup/webpack').default
module.exports = {
/* ... */
plugins: [
require('unplugin-vue2-script-setup/webpack')({ /* options */ }),
ScriptSetup({ /* options */ }),
]
}
```
Expand Down Expand Up @@ -209,10 +212,11 @@ export default {
```ts
// esbuild.config.js
import { build } from 'esbuild'
import ScriptSetup from 'unplugin-vue2-script-setup/esbuild'
build({
/* ... */
plugins: [
require('unplugin-vue2-script-setup/esbuild')({
ScriptSetup({
/* options */
}),
],
Expand Down
3 changes: 0 additions & 3 deletions src/rollup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import unplugin from '.'

export default unplugin.rollup
module.exports = unplugin.rollup
module.exports.default = unplugin.rollup
Object.defineProperty(module.exports, '__esModule', { value: true })
3 changes: 0 additions & 3 deletions src/vite.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import unplugin from '.'

export default unplugin.vite
module.exports = unplugin.vite
module.exports.default = unplugin.vite
Object.defineProperty(module.exports, '__esModule', { value: true })
3 changes: 0 additions & 3 deletions src/webpack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import unplugin from '.'

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

0 comments on commit 60a683a

Please sign in to comment.