Skip to content

Add module concatenation hint #2503

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

Merged
merged 1 commit into from
Sep 14, 2018
Merged

Add module concatenation hint #2503

merged 1 commit into from
Sep 14, 2018

Conversation

sirlancelot
Copy link
Contributor

Allow Webpack to process this file as an ES Module, which allows
concatenating using ModuleConcatenationPlugin, resulting in a slightly
smaller bundle and removes the overhead of a runtime require().

Allow Webpack to process this file as an ES Module, which allows
concatenating using ModuleConcatenationPlugin, resulting in a slightly
smaller bundle and removes the overhead of a runtime `require()`.
@sirlancelot
Copy link
Contributor Author

The export default null will get optimized away during tree-shaking.

@sirlancelot
Copy link
Contributor Author

Before:

// EXTERNAL MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
var setPublicPath = __webpack_require__("1eb2");

Webpack module:

/***/ "1eb2":
/***/ (function(module, exports, __webpack_require__) {

// This file is imported into lib/wc client bundles.

if (typeof window !== 'undefined') {
  let i
  if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js$/))) {
    __webpack_require__.p = i[1] // eslint-disable-line
  }
}


/***/ }),

After:

// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.

if (typeof window !== 'undefined') {
  let i
  if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js$/))) {
    __webpack_require__.p = i[1] // eslint-disable-line
  }
}

/* harmony default export */ var setPublicPath = (null);

@haoqunjiang haoqunjiang merged commit 09305db into vuejs:dev Sep 14, 2018
@sirlancelot sirlancelot deleted the patch-1 branch September 16, 2018 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants