jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.21k stars 505 forks source link

parcel error when running example #1060

Open jckr opened 2 years ago

jckr commented 2 years ago

Current Behavior

going into an example folder, and starting the project ie with npm run start, gets this error: @parcel/transformer-js: Browser scripts cannot have imports or exports.

Expected behavior

The build succeeds

Suggested solution(s)

In the index.html template, adding type="module" to the script tag that loads index.tsx does the trick.

Additional context

Your environment

System:
    OS: macOS 11.4
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 192.52 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.4.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.18.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 91.0.4472.114
    Chrome Canary: 93.0.4575.0
    Safari: 14.1.1
  npmPackages:
    typescript: ^3.4.5 => 3.9.10 
  npmGlobalPackages:
    typescript: 4.3.5