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

🐛 --public-url is setted on build and watch #714

Closed
corlaez opened this issue Jan 31, 2018 · 4 comments
Closed

🐛 --public-url is setted on build and watch #714

corlaez opened this issue Jan 31, 2018 · 4 comments
Labels

Comments

@corlaez
Copy link

corlaez commented Jan 31, 2018

When I work with parcel index.html the resulting files have public-url set to ./, when I use build or watch the public url is no longer ./ but ./build.

Reproducing the error:

https://github.com/lrn2prgrm/parcel-bug/tree/master

🎛 Configuration (.babelrc, package.json, cli command)

{
"name": "cli",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"dev-serve": "parcel src/index.html -d build --no-cache",
"watch": "parcel watch src/index.html -d build --no-cache",
"build": "parcel build src/index.html -d build --no-minify --no-cache",
"start": "yarn build"
},
"devDependencies": {
"parcel-bundler": "^1.5.1",
"typescript": "^2.6.2"
}
}

🤔 Expected Behavior

watch and build produced files should be generated as if public url is ./

either with

  • "prestart": "yarn build",
  • "prestart": "yarn watch",

dev-serve behaves correctly

😯 Current Behavior

watch and build produced files should be generated as if public url is ./build

either with

  • "prestart": "yarn build",
  • "prestart": "yarn watch",

dev-serve behaves correctly

💁 Possible Solution

No idea about implementation but the code that adds this public url should be found and modified

🌎 Environment

| Software | Version(s)
| Parcel | 1.5.1
| Node | 8.9.2
| Yarn | 1.2.1
| OS | Windows 10 Pro

Found as I closed this issue thanks to niicojs: #706

@corlaez
Copy link
Author

corlaez commented Jan 31, 2018

I realise I am defining an output directory, at the moment this flag is being interpreted could be when the default url is getting setted.

@Siyfion
Copy link

Siyfion commented Jan 31, 2018

I also think that this behaviour is somewhat unexpected, though I know that changing it would be a breaking change, I think it should be considered.

@fathyb
Copy link
Contributor

fathyb commented Feb 2, 2018

I think this is a more a RFC than a bug.
When using serve we set the public-url because we are in charge of serving files over HTTP. I don't see any use-case where serve + --public-url is used.
When using build or watch the public-url is the out-dir by default.

But I agree that using anything else than / by default for the public-url is confusing as IMHO most people expect a build dir with a index.html and resources served on the same directory.

@Siyfion
Copy link

Siyfion commented Feb 5, 2018

But I agree that using anything else than / by default for the public-url is confusing as IMHO most people expect a build dir with a index.html and resources served on the same directory.

Couldn't agree more, for most I would imagine that this is far from the expected behaviour.

devongovett added a commit that referenced this issue Mar 22, 2018
Now that this works correctly in the dev server as of #974, this should be a much more sensible default for both production and development builds. Fixes #714.
devongovett added a commit that referenced this issue Mar 22, 2018
Now that this works correctly in the dev server as of #974, this should be a much more sensible default for both production and development builds. Fixes #714.
devongovett added a commit that referenced this issue Oct 15, 2018
Now that this works correctly in the dev server as of #974, this should be a much more sensible default for both production and development builds. Fixes #714.
devongovett added a commit that referenced this issue Oct 15, 2018
Now that this works correctly in the dev server as of #974, this should be a much more sensible default for both production and development builds. Fixes #714.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants