brandonroberts / ng-astro

Hackathon project for Astro 1.0. Demos Angular v13 working with Astro, using SSR on the server-side, and client side hydration.
15 stars 2 forks source link

error: Cannot transform with linked or external legal comments #1

Closed StephanB7 closed 2 years ago

StephanB7 commented 2 years ago

Hi Brandon,

thanks for this repo and your awesome blog post on astro! I was thrilled when I saw you continued working on an astro-angular integration. I tried adding ng-astro and a bare astro page to a ng-14 cli project but as soon as I include the angular() from astro-angular in my astro.config.mjs I got an error and I really can't find anything on google to help with the issue.

> angular-app@0.0.0 build-astro
> astro build

02:34:02 PM [build] output target: static
02:34:02 PM [build] Collecting build info...
02:34:02 PM [build] Completed in 32ms.
02:34:02 PM [build] Building static entrypoints...
02:34:04 PM [build] Completed in 2.32s.

 building client 
vite v3.0.5 building for production...
✓ 234 modules transformed.
[vite:esbuild-transpile] Transform failed with 1 error:
error: Cannot transform with linked or external legal comments

Cannot transform with linked or external legal comments

 error   Transform failed with 1 error:
  error: Cannot transform with linked or external legal comments
  Code:

    Cannot transform with linked or external legal comments

  Stacktrace:
    at failureErrorWithLog (/Users/sb/Documents/MA/Angular/angular-app/node_modules/esbuild/lib/main.js:1605:15)
    at /Users/sb/Documents/MA/Angular/angular-app/node_modules/esbuild/lib/main.js:1394:29
    at /Users/sb/Documents/MA/Angular/angular-app/node_modules/esbuild/lib/main.js:666:9
    at handleIncomingPacket (/Users/sb/Documents/MA/Angular/angular-app/node_modules/esbuild/lib/main.js:763:9)
    at Socket.readFromStdout (/Users/sb/Documents/MA/Angular/angular-app/node_modules/esbuild/lib/main.js:632:7)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

Process finished with exit code 1

I know you're probably very busy but I'd be extremely happy if you could give me hint on what might be the problem. Thanks in advance!

brandonroberts commented 2 years ago

Thanks @StephanB7! Yes, I've resolved this issue in the Vite plugin https://github.com/analogjs/analog/pull/29 but haven't released a new version yet. A workaround is to provide the NODE_ENV=production with the build

NODE_ENV=production astro build
StephanB7 commented 2 years ago

Thank you so much for the quick reply and taking the time - for some random guy who opened an issue in you repo! :) This made the error go away.