1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

33 commits

Author SHA1 Message Date
Tim Neutkens 695f372da9
Compile away next/link proptypes in production (#5155)
This saves 7KB as prop-types-exact is not needed in production.
2018-09-14 11:34:08 +02:00
Tim Neutkens 3582496913
Trigger page register when module is executed (#5115)
Solves inconsistent loading issues when one bundle is loaded faster than the other

Fixes zeit/next-plugins#244
Fixes #4997
Fixes #4620
2018-09-11 20:03:20 +02:00
Tim Neutkens d21603707e
Set cwd on babel-loader (#5127)
Fixes #5125

I'm not sure if this is a bug in babel-loader / babel-core or not. But this will at least temporary fix it till I hear back from @loganfsmyth 🙏
2018-09-09 01:10:47 +02:00
Julia Qiu a9b1383b5d Fix @babel/env modules config (#5119)
Probably an oversight but currently env preset's `modules` option always evaluates to 'auto'. We probably want it to be set to false, especially in prod, to have Webpack handle modules natively.
2018-09-07 11:42:10 +02:00
Tim Neutkens 673378e415
Use DefinePlugin to pass distDir instead of manually passing (#5105) 2018-09-05 17:49:49 +02:00
Tim Neutkens d6c7050816
Remove module.exports from client bundles (#5093)
Removes `module.exports` so that `module` is no longer required

Ref: https://github.com/zeit/next.js/pull/4943#discussion_r213232263

This saves 15 bytes from every client bundle + 9 bytes from the initial HTML.
2018-09-04 17:30:01 +02:00
Tim Neutkens 1cdc25ff79
Use terser for minification (#5083)
Fixes #5021
2018-09-03 20:59:11 +02:00
Tim Neutkens b97fc82aa1
Use preset-react's development option + enable modules transform in test env (#5081)
## Minor changes

When `NODE_ENV=test` is used we'll now apply the `'auto'` configuration for modules transformation. Which causes Babel to check if the current environment needs to be transformed or not. In practice this means that the following `.babelrc` is not needed anymore:

**OLD**:

```json
{
  "env": {
    "development": {
      "presets": ["next/babel"]
    },
    "production": {
      "presets": ["next/babel"]
    },
    "test": {
      "presets": [["next/babel", { "preset-env": { "modules": "commonjs" } }]]
    }
  }
}
```

**NEW**:

```
{
  "presets": ["next/babel"]
}
```

## Patches

`@babel/preset-react` has a `development` option that automatically applies a development-time plugin we manually applied before (`@babel/plugin-transform-react-jsx-source`). It also adds another development-time plugin that is said to make debugging/errors clearer: `@babel/plugin-transform-react-jsx-self` which we didn't apply before. Overall this means we can take advantage of preset-react to provide these plugins.
2018-09-03 16:41:52 +02:00
Bertrand Marron 2eeebacb4c Keep chunks filenames in production mode (#5029)
* Keep chunks filenames in production mode

* Add test for new `[name]` behavior

* Rename static/dll to static/development/dll
2018-09-03 01:40:21 +02:00
Tim Neutkens e1c544cd75
Fix loading... issue (#5058)
This fixes intermittent `loading...` on some requests which surfaced on zeit.co when upgrading
2018-08-30 14:02:18 +02:00
Tim Neutkens 18a23b3e4b
Set mode for DLL bundle (#5059) 2018-08-30 12:27:22 +02:00
Tim Neutkens e4a1e3746b
Use same extensions webpack supports, with addition of .jsx (#4960) 2018-08-24 10:29:51 +02:00
HaNdTriX d6676e6e2b Allow extending transform-runtime without loosing next defaults (#5022)
**Example:**

https://github.com/zeit/next.js/blob/canary/examples/with-configured-preset-env/.babelrc#L17-L20
2018-08-24 10:27:48 +02:00
Tim Neutkens 85c6a12eb5
Fix DLL for Windows (#4959)
* Implement autodllplugin

* Add flow-typed for autodll-webpack-plugin

* Improve onClick tests

* Make third test pass

* Make sure DLL bundle is loaded without async

* Add nonce

* Fix windows DLL path
2018-08-15 16:24:56 -07:00
Tim Neutkens b7e256ba01
Make onClick Link tests more consistent (#4954) 2018-08-15 12:42:56 -07:00
Tim Neutkens 1fe1f7fc49
Implement autodllplugin (#4951)
* Implement autodllplugin

* Add flow-typed for autodll-webpack-plugin
2018-08-13 15:09:05 -07:00
Alexander Kachkaev 9319c158a5 Upgrade Babel to 7.0.0-rc.1 (major) (#4937)
Fixes #4691
Fixes #4614

This PR gives path to https://github.com/zeit/next-plugins/pull/242

I did not add or remove `^` near dependency versions in package.json files. However, I don't exclude that some changes can be made given that rc is more stable than beta.
2018-08-13 10:34:08 -07:00
Tim Neutkens 2e62b87fff
Make wasm files load on ssr (#4942)
* Make wasm files load on ssr

* Upgrade React for tests
2018-08-10 09:37:27 -07:00
Connor Bär b50bad56be [BUG] Fix emit-file-loader compatibility with Webpack 4 (#4918)
## Context

When upgrading to Next.js 6.1.1-canary.4 and using the `emit-file-loader` included in Next.js, the following error is thrown:

```bash
 error  in ./src/graveyard/pages/_app.scss
Module build failed (from ../node_modules/next/dist/build/webpack/loaders/emit-file-loader.js):
TypeError: Cannot read property 'context' of undefined
    at Object.module.exports (~/project-root/node_modules/next/dist/build/webpack/load
ers/emit-file-loader.js:27:68)

 @ ./src/pages/_app.js 35:0-53 156:17-26 157:13-22
 @ multi ./pages/_app.js
```

`next.config.js` (shortened):
```js
module.exports = {
  webpack: (config, { dev }) => {
    config.module.rules.push({
      test: /\.scss$/,
      use: [
        {
          loader: 'emit-file-loader',
          options: {
            name: 'dist/[path][name].[ext].js'
          }
        },
        {
          loader: 'babel-loader',
          options: {
            babelrc: false,
            extends: path.resolve(__dirname, './src/.babelrc')
          }
        },
        'styled-jsx-css-loader',
        { loader: 'postcss-loader', options: { sourceMap: dev } },
        {
          loader: 'sass-loader',
          options: {
            sourceMap: dev
          }
        }
      ]
    });

    return config;
  }
};
```

## Suggested Fix

A quick Google search brought me to a [related issue in `webpack-loader`](https://github.com/webpack-contrib/worker-loader/issues/125). As pointed out in the [Webpack docs](https://webpack.js.org/api/loaders/#this-rootcontext):

> Starting with webpack 4, the formerly `this.options.context` is provided as `this.rootContext`.

This PR makes this change while maintaining backward compatibility.

## System information

Next.js: 6.1.1-canary.4
Node: v9.3.0
2018-08-07 13:49:30 -07:00
Sayuti Daniel 919b88509c Let webpack handle contenthash (#4895) 2018-08-04 11:18:20 -07:00
Sayuti Daniel bd3f65b37f Use contenthash instead of chunkhash (#4894)
https://github.com/webpack/webpack.js.org/issues/2096
2018-08-04 10:00:13 -07:00
Tim Neutkens 183866a96d
Add support for rendering .css chunks (#4861)
Depends on https://github.com/zeit/next-plugins/pull/228

Failing tests are expected as `@zeit/next-css` has to be updated/released first.

This implements rendering of `.css` chunks. Effectively removing the custom document requirement when adding next-css/sass/less/stylus.
2018-07-30 15:48:02 +02:00
Tim Neutkens 6a087c6a5d
Rename commons directory to runtime (#4853) 2018-07-27 19:29:25 +02:00
Tim Neutkens 475b426ed1
Compile pages to .next/static directory (#4828)
* Compile pages to .next/static/<buildid>/pages/<page>

* Fix test

* Export class instead of using exports

* Use constant for static directory

* Add comment about what the middleware does
2018-07-25 13:45:42 +02:00
Tim Neutkens 75476a9136
[WIP] Webpack 4, react-error-overlay, react-loadable (#4639)
Webpack 4, react-error-overlay, react-loadable (major)
2018-07-24 11:24:40 +02:00
Tim Neutkens 17e410a1d0
Fix Typescript HMR (#4689)
Fixes #4686

Adds tests for @zeit/next-typescript so that we don't regress on this again.

I've fixed an issue in the `next` CLI too which caused lingering processes when the process gets force killed, which is what we do in the test suite, so it kept running if there was no manual quit.
2018-06-28 20:07:41 +02:00
Andrew Cherniavskii 54ab3bc5be Fix code splitting on Windows (#4685)
Closes #4684
2018-06-28 15:19:39 +02:00
Steve Korshakov 7fcfb8bde9 Make production compilation faster (patch) (#4677)
I have spend whole day on profiling next.js compiling performance and one of the easy hacks to reduce built time is avoid doing full `stats.toJson()` that is heavy by default.
2018-06-27 10:34:15 +02:00
Tim Neutkens fc2d59de4d
Add class properties configuration (#4619) 2018-06-19 21:48:54 +02:00
Tim Neutkens d674dcc426
Move plugins and loaders to webpack folder (#4618)
Also adds basic `flow` to webpack.js and the plugins.
2018-06-16 19:23:02 +02:00
Tim Neutkens c3866649c4
Apply hot-self-accept to all pageExtensions (#4616)
This makes sure plugins like @zeit/next-typescript or @zeit/next-mdx don't have to provide the `hot-self-accept-loader`.
This fixes for example @zeit/next-mdx, which doesn't implement `pageExtensions` but we do use mdx as top level pages for https://github.com/zeit/docs
2018-06-16 15:51:00 +02:00
Tim Neutkens 4d2ca789d2
Only log out using external babelrc once (#4600) 2018-06-16 13:03:42 +02:00
Tim Neutkens f2c2519159
Move build directory outside of server folder (#4565)
The prepares for next-server.

I also took this as an opportunity to get all build directory paths from a single location, as they were previously scattered across webpack/babel plugins and loaders.
2018-06-14 19:30:14 +02:00