jaredpalmer / tsdx

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

Module parse failed: Unexpected token #1166

Closed MichalJana closed 1 year ago

MichalJana commented 1 year ago

Current Behavior

Hi, i created two example projects:

then I created component in core-app:

import * as React from 'react';

export default function TestComponent() {
  return (
    <div>
      <div>Hello</div>
    </div>
  );
}

and i make npm link between core-app and customer-a.

But when i use TestComponent in customer-a i got an error:

Compiled with problems:

ERROR in ../core-app/src/TestComponent.tsx 7:4

Module parse failed: Unexpected token (7:4)
File was processed with these loaders:
 * ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
 * ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| export default function TestComponent() {
|   return (
>     <div>
|       <div>Hello</div>

Expected behavior

Suggested solution(s)

Additional context

Your environment

    OS: Windows 10 10.0.19044
    CPU: (12) x64 AMD Ryzen 5 1600 Six-Core Processor
    Memory: 5.07 GB / 15.95 GB
  Binaries:
    Node: 18.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.0.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 109.0.5414.121
    Edge: Spartan (44.19041.1266.0), Chromium (109.0.1518.61)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    tsdx: ^0.14.1 => 0.14.1
    typescript: ^3.9.10 => 3.9.10
MichalJana commented 1 year ago

I found solution here https://stackoverflow.com/questions/65893787/create-react-app-with-typescript-and-npm-link-enums-causing-module-parse-failed