@storyblok/nuxt 3.0.0-beta.2 → 3.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module.js +19 -15
- package/package.json +1 -1
package/module.js
CHANGED
|
@@ -1,53 +1,57 @@
|
|
|
1
|
-
import path from "path"
|
|
2
|
-
import { defineNuxtModule, addPluginTemplate } from "@nuxt/kit"
|
|
1
|
+
import path from "path"
|
|
2
|
+
import { defineNuxtModule, addPluginTemplate } from "@nuxt/kit"
|
|
3
3
|
|
|
4
4
|
export const noopTransform = () => {
|
|
5
5
|
return {
|
|
6
6
|
props: [],
|
|
7
7
|
needRuntime: true,
|
|
8
|
-
}
|
|
9
|
-
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
10
|
|
|
11
11
|
export default defineNuxtModule({
|
|
12
12
|
name: "@storyblok/nuxt",
|
|
13
13
|
configKey: "storyblok",
|
|
14
14
|
defaults: {},
|
|
15
|
-
setup(options) {
|
|
15
|
+
setup(options, nuxt) {
|
|
16
16
|
addPluginTemplate({
|
|
17
17
|
src: path.resolve(__dirname, "templates/plugin.js"),
|
|
18
18
|
options,
|
|
19
|
-
})
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
nuxt.options.build.transpile.push(
|
|
22
|
+
path.resolve(__dirname, "composables/dist")
|
|
23
|
+
)
|
|
20
24
|
},
|
|
21
25
|
// We need to add the v-editable SSR impl or it will crash
|
|
22
26
|
// info here: https://github.com/vuejs/vue-next/issues/3298
|
|
23
27
|
hooks: {
|
|
24
28
|
"build:before": ({ nuxt }, config) => {
|
|
25
29
|
// If it's using Webpack
|
|
26
|
-
const isWebpack = nuxt.options.vite === false
|
|
27
|
-
const isProduction = nuxt.options.dev === false
|
|
30
|
+
const isWebpack = nuxt.options.vite === false
|
|
31
|
+
const isProduction = nuxt.options.dev === false
|
|
28
32
|
if (isWebpack || (!isWebpack && isProduction)) {
|
|
29
33
|
config.transpile = [
|
|
30
34
|
...(config.transpile || []),
|
|
31
35
|
"@storyblok/vue",
|
|
32
36
|
"storyblok-js-client",
|
|
33
|
-
]
|
|
37
|
+
]
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
const opts = config.loaders.vue.compilerOptions
|
|
37
|
-
const transforms = opts.directiveTransforms || {}
|
|
38
|
-
opts.directiveTransforms = { ...transforms, editable: noopTransform }
|
|
40
|
+
const opts = config.loaders.vue.compilerOptions
|
|
41
|
+
const transforms = opts.directiveTransforms || {}
|
|
42
|
+
opts.directiveTransforms = { ...transforms, editable: noopTransform }
|
|
39
43
|
},
|
|
40
44
|
"autoImports:extend": (autoimports) => {
|
|
41
45
|
autoimports.push({
|
|
42
46
|
from: "@storyblok/nuxt/composables",
|
|
43
47
|
name: "useStoryBridge",
|
|
44
48
|
as: "useStoryBridge",
|
|
45
|
-
})
|
|
49
|
+
})
|
|
46
50
|
autoimports.push({
|
|
47
51
|
from: "@storyblok/nuxt/composables",
|
|
48
52
|
name: "useStoryApi",
|
|
49
53
|
as: "useStoryApi",
|
|
50
|
-
})
|
|
54
|
+
})
|
|
51
55
|
},
|
|
52
56
|
},
|
|
53
|
-
})
|
|
57
|
+
})
|