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

allow publicPath in dev mode and do not automatically set nuxtStatic #279

Closed
wants to merge 3 commits into from

Conversation

cj
Copy link

@cj cj commented Feb 18, 2017

This refers to #25 and will allow you to use CDN's like cloudfront by setting the build.publicPath, it will also allow you to use nuxt with platforms like cordova because in dev mode you need to point to the full internal ip path like http://${host}:${port}/_nuxt/ to run on emulators or connected devices.

@codecov-io
Copy link

Codecov Report

Merging #279 into 0.9.10 will increase coverage by 0.7%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           0.9.10   #279     +/-   ##
=======================================
+ Coverage   99.29%   100%   +0.7%     
=======================================
  Files          11     11             
  Lines         426    422      -4     
=======================================
- Hits          423    422      -1     
+ Misses          3      0      -3
Impacted Files Coverage Δ
lib/build.js 100% <ø> (+1.52%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00c9abb...4c8d364. Read the comment docs.

@@ -80,7 +80,7 @@ export function renderRoute (url, context = {}) {
if (!context.nuxt.serverRendered) {
app = '<div id="__nuxt"></div>'
}
const publicPath = self.options.build.publicPath.indexOf('http') === 0 ? self.options.build.publicPath : urlJoin(self.options.router.base, self.options.build.publicPath)
const publicPath = self.options.build.publicPath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why removing the ternary? If the public path is /app/ and router.base is /my-site/, publicPath should be /app/my-site/

Copy link
Author

@cj cj Feb 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Atinux with the current code urlJoin(self.options.router.base, self.options.build.publicPath) wouldn't that end up being /my-site/app/ which is wrong?

The html files this variable is for rendering are the files generated by webpack and not handling the inner routes of the app. So in my opinion, the router.base shouldn't come into play.

Copy link
Author

@cj cj Feb 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cj
Copy link
Author

cj commented Feb 18, 2017

@Atinux this does lead into a bigger question I had when going through publicPath code, I think it becomes confusing mixing it in with router.base, as that is to do with vue-router and it will still work no matter the webpack.output.publicPath. I also think publicPath should not include /_nuxt/ but /_nuxt/ should be its own config variable like nuxtPath. I think these changes would lead to cleaner code, configs and less confusion. Let me know your thoughts. I'll work on a draft today, which I'll update this pull request with.

@Atinux
Copy link
Member

Atinux commented Feb 21, 2017

@cj actually, when you want to host your application made with nuxt generate and hosted on github on this url: https://atinux.github.io/my-project/

  1. The router.base needs to be /my-project/
  2. The publicPath needs to be /my-project/_nuxt/ otherwise it won't fetch the required resources.

@Atinux Atinux closed this Mar 1, 2017
@Atinux
Copy link
Member

Atinux commented Mar 1, 2017

Hi @cj

I implemented in the next release.

@lock
Copy link

lock bot commented Nov 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants