1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/server
João Granado 8c6a4ebb1d Fix generated page chunk when libraryTarget is umd (#4205)
This fixes the generated page chunk created by the webpack `pages-plugin` which adds a new line in the beginning of the template, when using `output.libraryTarget` set to be [`umd`](https://webpack.js.org/configuration/output/#module-definition-systems) it returns the module.

Consider the following example, which is the output with the previous implementation:

```js
(function webpackUniversalModuleDefinition(root, factory) {
  if(typeof exports === 'object' && typeof module === 'object')
    module.exports = factory();
  else if(typeof define === 'function' && define.amd)
    define([], factory);
  else if(typeof exports === 'object')
    exports["MyLibrary"] = factory();
  else
    root["MyLibrary"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
  return
    __NEXT_REGISTER_PAGE(...)
});
```

`__NEXT_REGISTER_PAGE()` won't be executed since a `return` statement followed by a new line is the same as having a semicolon inserted right after the `return`. By removing the new line in the beginning of the source concatenation (which I suppose was added for stylistic reasons) this works as expected.
2018-05-25 14:23:44 +02:00
..
build Fix generated page chunk when libraryTarget is umd (#4205) 2018-05-25 14:23:44 +02:00
lib Support Node 6 again. check if async/await is supported (#4283) 2018-05-06 18:39:29 +02:00
config.js Allow BUILD_ID to be set using generateBuildId (minor) (#3873) 2018-03-31 16:34:52 +02:00
document.js Expose app.js (#4129) 2018-04-12 10:33:22 +02:00
export.js Fixes 'next export' when exportPathMap function depends on runtime config (#4339) 2018-05-11 14:52:39 +02:00
hot-reloader.js Make sure _document doesn’t reload the page when switching pages 2018-05-16 10:08:18 +02:00
index.js Set cache-control public (again) (#4322) 2018-05-19 21:43:18 +02:00
next.js Programmatic API (#310) 2016-12-16 12:33:08 -08:00
on-demand-entry-handler.js Remove mz-fs and glob-promise (#4026) 2018-03-30 20:29:42 +05:30
render.js Update Cache-Control for render errors (#4111) 2018-05-06 22:57:27 +02:00
require.js Add flow, pages-manifest.json, defaultPathMap for export (minor) (#4066) 2018-03-30 15:08:09 +02:00
router.js Use a latest version of path-to-regexp for path-match (#3655) 2018-02-01 19:54:09 +01:00
utils.js Universal Webpack (#3578) 2018-01-30 16:44:44 +01:00