Skip to content

Commit 21106e7

Browse files
committed
docs: json-editor-vue should be transpiled in Nuxt 2
1 parent 0c4a779 commit 21106e7

File tree

7 files changed

+9154
-22
lines changed

7 files changed

+9154
-22
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,9 @@ npm i json-editor-vue vanilla-jsoneditor
514514

515515
export default {
516516
build: {
517+
// Vite 4 (Rollup 3) uses ES2020 as compiler target by default
518+
// Therefore Vite-4-built outputs should be transpiled in webpack 4
519+
transpile: ['json-editor-vue'],
517520
extend(config) {
518521
// Getting webpack to recognize the `.mjs` file
519522
config.module.rules.push({
@@ -555,6 +558,9 @@ const value = ref()
555558
export default {
556559
plugins: ['~/plugins/JsonEditorVue.client'],
557560
build: {
561+
// Vite 4 (Rollup 3) uses ES2020 as compiler target by default
562+
// Therefore Vite-4-built outputs should be transpiled in webpack 4
563+
transpile: ['json-editor-vue'],
558564
extend(config) {
559565
// Getting webpack to recognize the `.mjs` file
560566
config.module.rules.push({
@@ -607,6 +613,9 @@ npm i json-editor-vue vanilla-jsoneditor @vue/composition-api
607613

608614
export default {
609615
build: {
616+
// Vite 4 (Rollup 3) uses ES2020 as compiler target by default
617+
// Therefore Vite-4-built outputs should be transpiled in webpack 4
618+
transpile: ['json-editor-vue'],
610619
extend(config) {
611620
// Getting webpack to recognize the `.mjs` file
612621
config.module.rules.push({
@@ -657,6 +666,9 @@ export default {
657666
export default {
658667
plugins: ['~/plugins/JsonEditorVue.client'],
659668
build: {
669+
// Vite 4 (Rollup 3) uses ES2020 as compiler target by default
670+
// Therefore Vite-4-built outputs should be transpiled in webpack 4
671+
transpile: ['json-editor-vue'],
660672
extend(config) {
661673
// Getting webpack to recognize the `.mjs` file
662674
config.module.rules.push({
@@ -716,14 +728,14 @@ Ready to use right out of the box.
716728

717729
### Vue CLI 4 (webpack 4)
718730

719-
Vite 4 (Rollup 3) uses ES2020 as compiler target by default, therefore Vite-4-built outputs should be transpiled in webpack 4.
720-
721731
≥ v4.5.15
722732

723733
```js
724734
// vue.config.js
725735

726736
module.exports = {
737+
// Vite 4 (Rollup 3) uses ES2020 as compiler target by default
738+
// Therefore Vite-4-built outputs should be transpiled in webpack 4
727739
transpileDependencies: ['json-editor-vue'],
728740
}
729741
```
@@ -734,6 +746,8 @@ module.exports = {
734746
// vue.config.js
735747

736748
module.exports = {
749+
// Vite 4 (Rollup 3) uses ES2020 as compiler target by default
750+
// Therefore Vite-4-built outputs should be transpiled in webpack 4
737751
transpileDependencies: ['json-editor-vue'],
738752
configureWebpack: {
739753
module: {
@@ -754,8 +768,6 @@ module.exports = {
754768

755769
### Vue CLI 3 (webpack 4)
756770

757-
Vite 4 (Rollup 3) uses ES2020 as compiler target by default, therefore Vite-4-built outputs should be transpiled in webpack 4.
758-
759771
```shell
760772
npm i @babel/plugin-proposal-nullish-coalescing-operator @babel/plugin-proposal-optional-chaining -D
761773
```
@@ -775,6 +787,8 @@ module.exports = {
775787
// vue.config.js
776788

777789
module.exports = {
790+
// Vite 4 (Rollup 3) uses ES2020 as compiler target by default
791+
// Therefore Vite-4-built outputs should be transpiled in webpack 4
778792
transpileDependencies: ['json-editor-vue'],
779793
chainWebpack(config) {
780794
// Getting webpack to recognize the `.mjs` file

demo/nuxt2+vue2.6/.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

demo/nuxt2+vue2.6/nuxt.config.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ export default {
1111
{ hid: 'description', name: 'description', content: '' },
1212
{ name: 'format-detection', content: 'telephone=no' },
1313
],
14-
link: [
15-
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
16-
],
14+
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
1715
},
1816

1917
// Global CSS: https://go.nuxtjs.dev/config-css
20-
css: [
21-
],
18+
css: [],
2219

2320
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
2421
plugins: [
@@ -35,11 +32,11 @@ export default {
3532
],
3633

3734
// Modules: https://go.nuxtjs.dev/config-modules
38-
modules: [
39-
],
35+
modules: [],
4036

4137
// Build Configuration: https://go.nuxtjs.dev/config-build
4238
build: {
39+
transpile: ['json-editor-vue'],
4340
extend(config) {
4441
config.module.rules.push({
4542
test: /\.mjs$/,

demo/nuxt2+vue2.7/.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

demo/nuxt2+vue2.7/nuxt.config.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ export default {
1111
{ hid: 'description', name: 'description', content: '' },
1212
{ name: 'format-detection', content: 'telephone=no' },
1313
],
14-
link: [
15-
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
16-
],
14+
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
1715
},
1816

1917
// Global CSS: https://go.nuxtjs.dev/config-css
20-
css: [
21-
],
18+
css: [],
2219

2320
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
2421
plugins: [
@@ -35,11 +32,11 @@ export default {
3532
],
3633

3734
// Modules: https://go.nuxtjs.dev/config-modules
38-
modules: [
39-
],
35+
modules: [],
4036

4137
// Build Configuration: https://go.nuxtjs.dev/config-build
4238
build: {
39+
transpile: ['json-editor-vue'],
4340
extend(config) {
4441
config.module.rules.push({
4542
test: /\.mjs$/,

0 commit comments

Comments
 (0)