Skip to content

Cannot use import statement outside a module | when using @uiw/react-markdown-editor #9554

@Vishal17199

Description

@Vishal17199

Reproduction

StackBlitz - https://stackblitz.com/~/github.com/Vishal17199/remix-test?file=app/routes/_index.tsx

git repo - https://github.com/Vishal17199/remix-test

  1. created new project with vite and remix
  2. Install @uiw/react-markdown-editor
  3. Add import statement for '@uiw/react-markdown-editor' and use in app/routes/_index.tsx
  4. facing error message Cannot use import statement outside a module

System Info

System:
    OS: macOS 13.5
    CPU: (8) arm64 Apple M1 Pro
    Memory: 98.05 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.0.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 125.0.6422.141
    Safari: 16.6
  npmPackages:
    @remix-run/dev: ^2.9.2 => 2.9.2 
    @remix-run/node: ^2.9.2 => 2.9.2 
    @remix-run/react: ^2.9.2 => 2.9.2 
    @remix-run/serve: ^2.9.2 => 2.9.2 
    vite: ^5.1.0 => 5.2.12

Used Package Manager

npm

Expected Behavior

Markdown editor should work fine

Actual Behavior

Getting below error

Cannot use import statement outside a module
at new AsyncFunction ()
at instantiateModule (file:///Users/vishal/Documents/test/node_modules/vite/dist/node/chunks/dep-BKbDVx1T.js:56228:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5
Click outside, press Esc key, or fix the code to dismiss.
You can also disable this overlay by setting server.hmr.overlay to false in vite.config.ts.

Screenshot 2024-06-04 at 1 18 06 PM

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions