Integrating with Prismic.io


#1

Hi!

Feels like I am missing something fundamental so hoping to be pushed in the right direction.
I am looking to add prismic.io as a headless cms and was now just trying to connect according to their guide to be able to set the json that prismic gives me as a viewModel property in app.js.

I’m following prismics guide here https://prismic.io/docs/javascript/getting-started/integrating-with-an-existing-javascript-project

And basically just import the prismic-javascript module in app.js like this
import DefineMap from ‘can-define/map/’;
import route from ‘can-route’;
import Prismic from ‘prismic-javascript’;
import ‘can-route-pushstate’;
import ‘can-debug#?./is-dev’;

Getting all the correct intellisense in visual studio code but when I try to use Prismic I get
stealjs undefined is not an object evaluating st.items

Am I missing how to import and use modules in app.js? How would I go about with a start to use prismic as a headless cms (will be super helpful for localisation as well, which I am after).


#2

@Henst It seems like StealJS incorrectly detects that the prismic-javascript module is in AMD format. You can fix this by adding the following configuration to the steal section of your package.json:

    "meta": {
      "prismic-javascript": {
        "format": "global"
      }
    }