Closed rhkdgns95 closed 3 years ago
Interesting, thanks for filing this. We have this line in our optimize.ts
file that could be causing trouble:
external: Array.from(new Set(allFiles.map((f) => '*' + path.extname(f)))).filter(
(ext) => ext !== '*.js' && ext !== '*.mjs' && ext !== '*.css',
),
I think it's missing a check for a file without an extension, which would result in "*" being marked external (which would mean every file in your project). That's obviously not expected :)
I went ahead and fixed that issue in 0fc858cf. I'm still not 100% sure that that's the issue, but there's a good chance that it is.
Do you have any files in your build that don't hav an extension? If you do not, then it would be great to know what the result of external
is (the value that we're passing to external
and also the value of allFiles
) if you feel comfortable adding console.log messages and then re-running.
Closing this issue because we reserve issues for prioritized, triaged work. In the future, please create a Discussion!
Same issue here. Clean project using the Svelte configuration (https://www.snowpack.dev/tutorials/svelte). Config:
optimize: {
bundle: true,
minify: true,
target: 'es2018'
},
Error:
[snowpack] ! building source files...
[snowpack] ✔ build complete [0.16s]
[snowpack] ! building dependencies...
[snowpack] ✔ dependencies ready! [0.28s]
[snowpack] ! verifying build...
[snowpack] ✔ verification complete [0.00s]
[snowpack] ! writing build to disk...
[snowpack] ! optimizing build...
> error: The entry point "/snowpack/build/index.js" cannot be marked as external
> error: The entry point "/snowpack/build/index.css" cannot be marked as external
2 errors
[snowpack] Build failed with 2 errors:
error: The entry point "/snowpack/build/index.js" cannot be marked as external
error: The entry point "/snowpack/build/index.css" cannot be marked as external
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build: `snowpack build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /.npm/_logs/2021-01-17T17_55_11_811Z-debug.log
It looks like the issue is LICENSE
in the root folder. No extension, so it fails.
Interesting, thanks for filing this. We have this line in our
optimize.ts
file that could be causing trouble:external: Array.from(new Set(allFiles.map((f) => '*' + path.extname(f)))).filter( (ext) => ext !== '*.js' && ext !== '*.mjs' && ext !== '*.css', ),
I think it's missing a check for a file without an extension, which would result in "*" being marked external (which would mean every file in your project). That's obviously not expected :)
I went ahead and fixed that issue in 0fc858c. I'm still not 100% sure that that's the issue, but there's a good chance that it is.
Do you have any files in your build that don't hav an extension? If you do not, then it would be great to know what the result of
external
is (the value that we're passing toexternal
and also the value ofallFiles
) if you feel comfortable adding console.log messages and then re-running.
We just need to do a new Snowpack release of the fix. Or, you could check out this repo locally and run directly from the repo until that release goes out
Thank you for your quick response request. @FredKSchott
Updated to the latest version 3.0.11, the error persists.
optimize: {
bundle: true,
minify: false,
target: 'es2018'
},
I confirm that 3.0.11 does not fix the issue. Did a little investigation and it looks like version 3.0.11 just doesn't contain the fix https://github.com/snowpackjs/snowpack/blob/snowpack%403.0.11/snowpack/src/build/optimize.ts#L402. I hope https://github.com/snowpackjs/snowpack/commit/0fc858cf0e5ff65be57337985be63d68fa94035b will get to the next release.
Problem