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

Inconsistent builds #4002

Closed
pi0 opened this issue Sep 28, 2018 · 5 comments
Closed

Inconsistent builds #4002

pi0 opened this issue Sep 28, 2018 · 5 comments

Comments

@pi0
Copy link
Member

pi0 commented Sep 28, 2018

Meta

Version

v2.0.0

Reproduction link

dev

Steps to reproduce

  • ./bin/nuxt build examples/hello-world
  • NODE_ENV=production ./bin/nuxt build examples/hello-world

What is expected?

Results should be the same.

What is actually happening?

Chunk names are different. Also things like s.options.__file should be stripped but it is not.

Additional comments?

Normal build:

Hash: 77622da25e0d579af1b6
Version: webpack 4.20.2
Time: 8670ms
Built at: 2018-09-28 12:43:39
                  Asset       Size  Chunks             Chunk Names
87c9ae15a64580abbac1.js   29.5 KiB       0  [emitted]  app
4767e3f41bc29ddaa1e5.js  494 bytes       1  [emitted]  pages/about
7d029e4429ef3a4557bf.js  437 bytes       2  [emitted]  pages/index
67347ecf5af03458ef7b.js    133 KiB       3  [emitted]  commons.app
ce430f2c9428f9c92feb.js    2.2 KiB       4  [emitted]  runtime
               LICENSES  422 bytes          [emitted]
 + 3 hidden assets
Entrypoint app = ce430f2c9428f9c92feb.js 67347ecf5af03458ef7b.js 87c9ae15a64580abbac1.js

Hash: 3a2a3ea1bb1bb0a04c93
Version: webpack 4.20.2
Time: 669ms
Built at: 2018-09-28 12:43:39
             Asset     Size  Chunks             Chunk Names
server-bundle.json  147 KiB          [emitted]
Entrypoint app = server-bundle.js server-bundle.js.map

When setting NODE_ENV=production:

Hash: 1e074dabd64eeb326435
Version: webpack 4.20.2
Time: 7456ms
Built at: 2018-09-28 12:44:03
                  Asset       Size  Chunks             Chunk Names
964f935295162117ed63.js   29.4 KiB       0  [emitted]  app
06cd332c6aa0e8b0c1f0.js  467 bytes       1  [emitted]  pages/about
efb705924dd2b7ecdb9b.js  410 bytes       2  [emitted]  pages/index
67347ecf5af03458ef7b.js    133 KiB       3  [emitted]  commons.app
8856f1071f6ebf9241d1.js    2.2 KiB       4  [emitted]  runtime
               LICENSES  422 bytes          [emitted]
 + 3 hidden assets
Entrypoint app = 8856f1071f6ebf9241d1.js 67347ecf5af03458ef7b.js 964f935295162117ed63.js
[12:44:03] Compiling server
[12:44:04] Compiled server in 712ms

Hash: a80e17c0968574a4756b
Version: webpack 4.20.2
Time: 715ms
Built at: 2018-09-28 12:44:04
             Asset     Size  Chunks             Chunk Names
server-bundle.json  145 KiB          [emitted]
Entrypoint app = server-bundle.js server-bundle.js.map
This bug report is available on Nuxt community (#c7859)
@pi0
Copy link
Member Author

pi0 commented Sep 28, 2018

Additional details.

About page chunk with the normal build: (4767e3f41bc29ddaa1e5.js / 494 bytes)

(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{124:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("p",[this._v("Hi from "+this._s(this.name))]),this._v(" "),e("nuxt-link",{attrs:{to:"/"}},[this._v("Home page")])],1)};i._withStripped=!0;var a={asyncData:function(){return{name:"client"}},head:{title:"About page"}},s=n(17),o=Object(s.a)(a,i,[],!1,null,null,null);o.options.__file="about.vue";e.default=o.exports}}]);

With production env: (06cd332c6aa0e8b0c1f0.js / 467 bytes)

(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{124:function(t,e,n){"use strict";n.r(e);var i={asyncData:function(){return{name:"client"}},head:{title:"About page"}},s=n(17),a=Object(s.a)(i,function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("p",[this._v("Hi from "+this._s(this.name))]),this._v(" "),e("nuxt-link",{attrs:{to:"/"}},[this._v("Home page")])],1)},[],!1,null,null,null);a.options.__file="about.vue";e.default=a.exports}}]);

@pi0
Copy link
Member Author

pi0 commented Sep 28, 2018

This is probably because of not passing proper options to the vue-loader. (https://github.com/vuejs/vue-loader/blob/64af07915ac47ebb6bad3223fd2bd15dee908196/lib/loaders/templateLoader.js#L18)

@aldarund
Copy link

s.options.__file present inboth normal and production

@pi0
Copy link
Member Author

pi0 commented Sep 28, 2018

@aldarund It seems for production builds, a safe file name is being added. (Something intentional) Related PR: vuejs/vue-loader#1368

@pi0
Copy link
Member Author

pi0 commented Sep 28, 2018

Closing this issue as #4003's workaround is enough and no action would be required from us but upgrading vue-loader.

@pi0 pi0 closed this as completed Sep 28, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 31, 2018
@nuxt nuxt unlocked this conversation Jan 29, 2019
@nuxt nuxt deleted a comment from lock bot Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants