Closed techsin closed 4 years ago
what do I tell?
my package.json has following packages
"parcel": "^1.12.4",
"parcel-plugin-envkey": "^1.1.0",
"parcel-plugin-graphql-raw": "^1.0.3",
index.pug looks like this
index.pug
...
script(src="//domain.com/global/all.js" type="text/javascript")
Error: Cannot find module 'https//....'
For some reason, the :
is missing, and so Parcel doesn't recognize this as an url (and excludes it).
https://github.com/parcel-bundler/parcel/blob/v2/packages/core/parcel-bundler/src/utils/is-url.js
Are you sure this is valid pug syntax?
I tried it with without https as well, just script(src="//domain.com/global/all.js"
I think you need to use: script(src="https://domain.com/global/all.js"
as parcel will detect that as a valid link
//url....
is a valid url, at least common practice. it means use http if page is under http and use https if page is https.
Yes, //domain.com/xyz
is a valid url in html, but https//domain.com/xyz
isn't.
> require("pug").compile("script(src='//domain.com/global/all.js')")()
'<script src="//domain.com/global/all.js"></script>'
> require("is-url")("//domain.com/x")
true
> require("is-url")("https//domain.com/x")
false
The question is: where does that https
come from
It already was //domain.com/xyz
than i tried adding https.. anyways i tried again
Error: Cannot find module '//domain.com/global/all.js'
npx parcel --version
2.0.0-alpha.3.2
if i change it to proper https://domain.com
i get this error
import {Transformer} from '@parcel/plugin';
^
SyntaxError: Unexpected token {
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
@techsin could you give us a reproducible repo with that last issue?
Can't really tell what the issue is from that stack, I think it has to do with one of the plugins you use.
Ok I'll try
🐛 bug report
Parcel 2 tries to build online urls not only links to file on drive. It starts with html template that has script tags. Some script tags point to public cdn urls. Which are NOT meant to be bundled.
🎛 Configuration (.babelrc, package.json, cli command)
package.json
.babelrc
🤔 Expected Behavior
Not give an error
😯 Current Behavior
Error
Error: Cannot find module 'https//....'