Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup PARSE_ERROR and error in the UI #25

Open
emanuelet opened this issue May 28, 2021 · 2 comments
Open

Rollup PARSE_ERROR and error in the UI #25

emanuelet opened this issue May 28, 2021 · 2 comments

Comments

@emanuelet
Copy link

When I try to add the upload functionality for my Blog mongoose model I get this error when I start the server

Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at error (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:7862:30)
    at Module.error (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:9795:16)
    at Module.tryParse (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:10193:25)
    at Module.setSource (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:10097:24)
    at ModuleLoader.addModuleSource (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:19399:20)
    at ModuleLoader.fetchModule (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:19455:9)
    at async Promise.all (index 0)
    at ModuleLoader.fetchStaticDependencies (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:19481:34)
    at async Promise.all (index 0)
    at ModuleLoader.fetchModule (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:19457:9)
    at async Promise.all (index 0) {
  code: 'PARSE_ERROR',
  parserError: SyntaxError: Unexpected token (6:10)
      at Parser.pp$4.raise (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:16681:13)
      at Parser.pp.unexpected (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:14191:8)
      at Parser.pp$1.parseVar (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:14732:12)
      at Parser.pp$1.parseVarStatement (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:14594:8)
      at Parser.pp$1.parseStatement (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:14344:17)
      at Parser.pp$1.parseTopLevel (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:14248:21)
      at Parser.parse (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:14040:15)
      at Function.parse (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:14071:35)
      at Graph.contextParse (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:20009:38)
      at Module.tryParse (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:10183:31)
      at Module.setSource (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:10097:24)
      at ModuleLoader.addModuleSource (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:19399:20)
      at ModuleLoader.fetchModule (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:19455:9)
      at async Promise.all (index 0)
      at ModuleLoader.fetchStaticDependencies (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:19481:34)
      at async Promise.all (index 0)
      at ModuleLoader.fetchModule (/home/Projects/litepages_backend/node_modules/rollup/dist/shared/rollup.js:19457:9)
      at async Promise.all (index 0) {
    pos: 261,
    loc: Position { line: 6, column: 10 },
    raisedAt: 262
  },
  id: '/home/Projects/litepages_backend/node_modules/@admin-bro/upload/src/features/upload-file/components/edit.tsx',
  pos: 261,
  loc: {
    column: 10,
    file: '/home/Projects/litepages_backend/node_modules/@admin-bro/upload/src/features/upload-file/components/edit.tsx',
    line: 6
  },
  frame: "4: import PropertyCustom from '../types/property-custom.type'\n" +
    '5: \n' +
    '6: const Edit: FC<EditPropertyProps> = ({ property, record, onChange }) => {\n' +
    '             ^\n' +
    '7:   const { params } = record\n' +
    '8:   const { custom } = property as unknown as { custom: PropertyCustom }',
  watchFiles: [
    '/home/Projects/litepages_backend/.adminbro/.entry.js',
    '/home/Projects/litepages_backend/node_modules/@admin-bro/upload/src/features/upload-file/components/edit.tsx',
    '/home/Projects/litepages_backend/node_modules/@admin-bro/upload/src/features/upload-file/components/list.tsx',
    '/home/Projects/litepages_backend/node_modules/@admin-bro/upload/src/features/upload-file/components/show.tsx'
  ]
}

I'm running

    "@admin-bro/express": "^3.1.0",
    "@admin-bro/mongoose": "^1.1.0",
    "@admin-bro/upload": "^1.3.1",
    "admin-bro": "^4.0.1",

and this is my resources configuration:

resources: [
        {
          resource: Blog,
          features: [
            uploadFeature({
              provider: { aws: { ...config.aws } },
              properties: {
                key: 'bannerImage', // to this db field feature will safe S3 key
                // where mime type will be stored
                mimeType: `mimeType`,
                // where bucket name will be stored
                bucket: `bucket`,
                // where size will be stored
                size: `size`,
              },
              validation: {
                mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
              },
            }),
          ],
          options: {
            properties: {
              text: {
                type: 'richtext',
                props: {
                  borderless: true,
                },
              },
              bannerImage: {
                isVisible: false,
              },
              createdAt: {
                isVisible: {
                  list: true,
                  filter: true,
                  show: true,
                  edit: false,
                },
              },
              updatedAt: {
                isVisible: {
                  list: true,
                  filter: true,
                  show: true,
                  edit: false,
                },
              },
              slug: {
                isVisible: {
                  list: true,
                  filter: true,
                  show: true,
                  edit: false,
                },
              },
              slug_history: {
                isVisible: {
                  list: true,
                  filter: true,
                  show: true,
                  edit: false,
                },
              },
            },
          },
        }
      ],

If I open the view to create a new record I get this error

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check the render method of `BasePropertyComponent`.

Desktop-screenshot

Has anyone had a similar issue?

@anhlevfx
Copy link

anhlevfx commented Jun 1, 2022

Hi @emanuelet , I'm facing the issue like you when open in web browser. Did you resolve it?

@emanuelet
Copy link
Author

not that I remember. Also haven't been using the package in a while

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants