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

Fix build "terser minification error" #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nooitaf
Copy link

@nooitaf nooitaf commented Feb 4, 2023

Dynamic imports in router.js seem to confuse the build phase..
Related issue: #1

This builds fine now.

Before:

$ meteor build ../docker/builds/
⚡️ Building packages to make them available to export analyzer...
⚡️ Packages built (11549.98ms)
⚡️ Building with Vite...
vite v3.2.5 building for production...
transforming...
✓ 33 modules transformed.
rendering chunks...
node_modules/.vite-meteor/dist/meteor-entry.js   0.02 KiB / gzip: 0.04 KiB
node_modules/.vite-meteor/dist/About.js          0.59 KiB / gzip: 0.33 KiB
node_modules/.vite-meteor/dist/main.js           285.62 KiB / gzip: 67.41 KiB

⚡️ Build successful (917.73ms)
Errors prevented bundling:                    
While minifying app code:                     
packages/minifyStdJS/plugin/minify-js.js:49:25: terser minification error (SyntaxError:"Import" statement may only appear at the top level)
Source file: client/main.js  (2:0)
Line content: import "./vite/meteor-entry.js"

at maybeThrowMinifyErrorBySourceFile (packages/minifyStdJS/plugin/minify-js.js:49:25)
at packages/minifyStdJS/plugin/minify-js.js:77:11
at Array.forEach (<anonymous>)
at MeteorMinifier.processFilesForBundle (packages/minifyStdJS/plugin/minify-js.js:66:11)


While minifying app code:
packages/minifyStdJS/plugin/minify-js.js:49:25: terser minification error (SyntaxError:"Import" statement may only appear at the top level)
Source file: client/main.js  (2:0)
Line content: import "./vite/meteor-entry.js"

at maybeThrowMinifyErrorBySourceFile (packages/minifyStdJS/plugin/minify-js.js:49:25)
at packages/minifyStdJS/plugin/minify-js.js:77:11
at Array.forEach (<anonymous>)
at MeteorMinifier.processFilesForBundle (packages/minifyStdJS/plugin/minify-js.js:66:11)

After:

$ meteor build ../docker/builds/
⚡️ Building packages to make them available to export analyzer...
⚡️ Packages built (4963.63ms)
⚡️ Building with Vite...
vite v3.2.5 building for production...
transforming...
✓ 33 modules transformed.
rendering chunks...
node_modules/.vite-meteor/dist/meteor-entry.js   295.17 KiB / gzip: 69.45 KiB

⚡️ Build successful (911.32ms)

Dynamic imports seem to confuse the build phase.. 
This builds fine now.
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

Successfully merging this pull request may close these issues.

1 participant