@nuxtjs/prismic 1.4.3 → 1.5.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/module.js +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/prismic",
3
- "version": "1.4.3",
3
+ "version": "1.5.0",
4
4
  "description": "Easily connect your Nuxt.js application to your content hosted on Prismic",
5
5
  "keywords": [
6
6
  "nuxt",
package/src/module.js CHANGED
@@ -22,6 +22,15 @@ function install (moduleOptions) {
22
22
  logger.warn('Options `endpoint` is required, disabling module...')
23
23
  return
24
24
  }
25
+ if (process.env.NUXT_PUBLIC_PRISMIC_ENVIRONMENT) {
26
+ options.endpoint = process.env.NUXT_PUBLIC_PRISMIC_ENVIRONMENT
27
+ try {
28
+ // eslint-disable-next-line no-new
29
+ new URL(options.endpoint)
30
+ } catch (error) {
31
+ options.endpoint = `https://${options.endpoint}.cdn.prismic.io/api/v2`
32
+ }
33
+ }
25
34
 
26
35
  this.options.build.transpile.push('@prismicio/vue', '@prismicio/simulator')
27
36