sanity-super-pane icon indicating copy to clipboard operation
sanity-super-pane copied to clipboard

Module parse failed: Unexpected token (in index.esm.js)

Open ppo opened this issue 3 years ago • 1 comments

Version: 1.0.0-alpha.1

Error

Error in ./node_modules/sanity-super-pane/dist/index.esm.js
Module parse failed: Unexpected token (159:30)
You may need an appropriate loader to handle this file type.
|
|       for (const publishedDocument of publishedDocuments) {
|         t.createIfNotExists({ ...publishedDocument,
|           _id: `drafts.${publishedDocument._id}`,
|           _updatedAt: new Date().toISOString()
 @ ./deskStructure.js (part:@sanity/desk-tool/structure 10:23-51)
 @ ./node_modules/@sanity/desk-tool/lib/utils/loadStructure.js
 @ ./node_modules/@sanity/desk-tool/lib/utils/useResolvedPanes.js
 @ ./node_modules/@sanity/desk-tool/lib/DeskTool.js
 @ ./node_modules/@sanity/desk-tool/lib/_parts/base-tool.js
 @ ./node_modules/@sanity/vision/lib/VisionTool.js (all:part:@sanity/base/tool)
 @ ./node_modules/@sanity/default-layout/lib/router.js
 @ ./node_modules/@sanity/default-layout/lib/Root.js (part:@sanity/base/root)
 @ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
 @ ./node_modules/@sanity/server/lib/browser/entry-dev.js
 @ multi ./node_modules/@sanity/server/lib/browser/entry-dev.js

deskStructue.js

import S from '@sanity/desk-tool/structure-builder';
import { createSuperPane } from 'sanity-super-pane';

export default () =>
  S.list()
    .title('Base')
    .items([
      S.listItem().title('Normal List').child(createSuperPane('movie', S)),
    ]);

ppo avatar Jan 04 '22 11:01 ppo

Ran into this as well, seems to be related to using external packages with more modern EcmaScript syntax.

This post includes a work-around to fix it: https://github.com/sanity-io/sanity/issues/2092#issuecomment-1017433178

fschultz avatar Feb 26 '22 22:02 fschultz