Skip to content

Nondeterministic builds with multipage app and default babel polyfills #2983

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

Closed
jcushman opened this issue Nov 20, 2018 · 0 comments · Fixed by #3565
Closed

Nondeterministic builds with multipage app and default babel polyfills #2983

jcushman opened this issue Nov 20, 2018 · 0 comments · Fixed by #3565

Comments

@jcushman
Copy link

jcushman commented Nov 20, 2018

Version

3.1.1

Reproduction link

https://github.com/jcushman/vue_cli_polyfills_bug

Node and OS info

Node 11.1.0 / npm 6.4.1 / OS X 10.12.6

Steps to reproduce

  • Install package.json requirements (I used npm i)
  • Repeatedly run sudo rm -r node_modules/.cache/; npx vue-cli-service build; git status

What is expected?

git status should print On branch master; nothing to commit, working tree clean, as dist/ files are in source control and src/ has not changed.

What is actually happening?

About half the time, git status reports files modified:

modified:   dist/js/page1.js
modified:   dist/js/page1.js.map
modified:   dist/js/page2.js
modified:   dist/js/page2.js.map
modified:   dist/js/page3.js
modified:   dist/js/page3.js.map

The changes look like the adding or removing of three lines of whitespace, and the adding or removing of these lines:

/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cadf");
/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var core_js_modules_es6_promise__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("551c");
/* harmony import */ var core_js_modules_es6_promise__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_promise__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var core_js_modules_es7_promise_finally__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("097d");
/* harmony import */ var core_js_modules_es7_promise_finally__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es7_promise_finally__WEBPACK_IMPORTED_MODULE_2__);

For context of why this matters: I want npx vue-cli-service build to not modify the output files if the input files have not changed. That's both because I want to keep the build artifacts in source control and have a test server check if they are up to date, and I don't want every deploy to break the hashes on cached resources.

In the linked repo, the default imports injected by babel-preset-app randomly appear and disappear on consecutive runs. There are also three lines of whitespace that randomly appear and disappear.

The issue is specific to multipage apps that import libraries across entrypoints. My example repo has 3 entrypoints that collectively import 5 libraries, which is based on the real code where I found this issue. If I simplify the repro further, I find the problem still happens but more intermittently.

Initial debugging: I included a commented-out workaround in babel.config.js that disables the default polyfills. This does avoid the issue if you don't need polyfills, but I don't have any idea what the underlying issue is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants