-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Upgrade Babel 6 to Babel 7 (major) #4050
Changes from all commits
bab70b1
9b848a0
df71be2
ecc8eb0
541e933
98581a5
bbb164b
41bf9a2
eb07d7d
efe0bef
d3dadcf
90b6765
a133915
13eaa21
809b2e8
b3d4803
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable */ | ||
import React, { Component } from 'react' | ||
import { connect } from 'react-redux' | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable */ | ||
import { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "next", | ||
"version": "6.0.0-canary.2", | ||
"version": "5.0.1-canary.17", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this accidentally reverted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah fixed already There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's release as 6.0.0-canary.3 |
||
"description": "Minimalistic framework for server-rendered React applications", | ||
"main": "./dist/server/next.js", | ||
"license": "MIT", | ||
|
@@ -52,22 +52,23 @@ | |
"bin/*": "standard" | ||
}, | ||
"dependencies": { | ||
"@babel/core": "7.0.0-beta.42", | ||
"@babel/plugin-proposal-class-properties": "7.0.0-beta.42", | ||
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.42", | ||
"@babel/plugin-syntax-dynamic-import": "7.0.0-beta.42", | ||
"@babel/plugin-transform-react-jsx-source": "7.0.0-beta.42", | ||
"@babel/plugin-transform-runtime": "7.0.0-beta.42", | ||
"@babel/preset-env": "7.0.0-beta.42", | ||
"@babel/preset-react": "7.0.0-beta.42", | ||
"@babel/runtime": "7.0.0-beta.42", | ||
"@babel/template": "7.0.0-beta.42", | ||
"@zeit/check-updates": "1.1.1", | ||
"@zeit/source-map-support": "0.6.2", | ||
"ansi-html": "0.0.7", | ||
"babel-core": "6.26.0", | ||
"babel-loader": "7.1.2", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-loader": "8.0.0-beta.2", | ||
"babel-plugin-react-require": "3.0.0", | ||
"babel-plugin-syntax-dynamic-import": "6.18.0", | ||
"babel-plugin-transform-class-properties": "6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "6.26.0", | ||
"babel-plugin-transform-react-jsx-source": "6.22.0", | ||
"babel-plugin-transform-react-remove-prop-types": "0.4.8", | ||
"babel-plugin-transform-runtime": "6.23.0", | ||
"babel-preset-env": "1.6.0", | ||
"babel-preset-react": "6.24.1", | ||
"babel-runtime": "6.26.0", | ||
"babel-template": "6.26.0", | ||
"babel-plugin-transform-react-remove-prop-types": "0.4.13", | ||
"case-sensitive-paths-webpack-plugin": "2.1.1", | ||
"cross-spawn": "5.1.0", | ||
"del": "3.0.0", | ||
|
@@ -77,7 +78,7 @@ | |
"fresh": "0.5.2", | ||
"friendly-errors-webpack-plugin": "1.6.1", | ||
"glob": "7.1.2", | ||
"hoist-non-react-statics": "2.5.0", | ||
"hoist-non-react-statics": "2.3.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🍶 |
||
"htmlescape": "1.1.1", | ||
"http-errors": "1.6.2", | ||
"http-status": "1.0.1", | ||
|
@@ -106,7 +107,8 @@ | |
"write-file-webpack-plugin": "4.2.0" | ||
}, | ||
"devDependencies": { | ||
"@taskr/babel": "1.1.0", | ||
"@babel/preset-flow": "7.0.0-beta.43", | ||
"@taskr/babel": "1.1.0-next.1", | ||
"@taskr/clear": "1.1.0", | ||
"@taskr/esnext": "1.1.0", | ||
"@taskr/watch": "1.1.0", | ||
|
@@ -115,8 +117,6 @@ | |
"babel-jest": "21.2.0", | ||
"babel-plugin-istanbul": "4.1.5", | ||
"babel-plugin-transform-remove-strict-mode": "0.0.2", | ||
"babel-preset-es2015": "6.24.1", | ||
"babel-preset-flow": "6.23.0", | ||
"benchmark": "2.1.4", | ||
"cheerio": "0.22.0", | ||
"chromedriver": "2.32.3", | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,16 @@ import UglifyJSPlugin from 'uglifyjs-webpack-plugin' | |
import CaseSensitivePathPlugin from 'case-sensitive-paths-webpack-plugin' | ||
import WriteFilePlugin from 'write-file-webpack-plugin' | ||
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin' | ||
import {loadPartialConfig, createConfigItem} from '@babel/core' | ||
import {getPages} from './webpack/utils' | ||
import PagesPlugin from './plugins/pages-plugin' | ||
import NextJsSsrImportPlugin from './plugins/nextjs-ssr-import' | ||
import DynamicChunksPlugin from './plugins/dynamic-chunks-plugin' | ||
import UnlinkFilePlugin from './plugins/unlink-file-plugin' | ||
import PagesManifestPlugin from './plugins/pages-manifest-plugin' | ||
import findBabelConfig from './babel/find-config' | ||
|
||
const presetItem = createConfigItem(require('./babel/preset'), {type: 'preset'}) | ||
const hotLoaderItem = createConfigItem(require('react-hot-loader/babel'), {type: 'plugin'}) | ||
|
||
const nextDir = path.join(__dirname, '..', '..', '..') | ||
const nextNodeModulesDir = path.join(nextDir, 'node_modules') | ||
|
@@ -29,29 +32,26 @@ function babelConfig (dir, {isServer, dev}) { | |
cacheDirectory: true, | ||
presets: [], | ||
plugins: [ | ||
dev && !isServer && require.resolve('react-hot-loader/babel') | ||
dev && !isServer && hotLoaderItem | ||
].filter(Boolean) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as below about |
||
|
||
const externalBabelConfig = findBabelConfig(dir) | ||
if (externalBabelConfig) { | ||
const filename = path.join(dir, 'filename.js') | ||
const externalBabelConfig = loadPartialConfig({ babelrc: true, filename }) | ||
if (externalBabelConfig && externalBabelConfig.babelrc) { | ||
// Log it out once | ||
if (!isServer) { | ||
console.log(`> Using external babel configuration`) | ||
console.log(`> Location: "${externalBabelConfig.loc}"`) | ||
console.log(`> Location: "${externalBabelConfig.babelrc}"`) | ||
} | ||
// It's possible to turn off babelrc support via babelrc itself. | ||
// In that case, we should add our default preset. | ||
// That's why we need to do this. | ||
const { options } = externalBabelConfig | ||
mainBabelOptions.babelrc = options.babelrc !== false | ||
// By default babel-loader will look for babelrc, so no need to set it to true | ||
} else { | ||
mainBabelOptions.babelrc = false | ||
} | ||
|
||
// Add our default preset if the no "babelrc" found. | ||
if (!mainBabelOptions.babelrc) { | ||
mainBabelOptions.presets.push(require.resolve('./babel/preset')) | ||
mainBabelOptions.presets.push(presetItem) | ||
} | ||
|
||
return mainBabelOptions | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* eslint-disable */ | ||
import React from 'react' | ||
|
||
export default () => <>My component!</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we're on the same page, I'm a little confused about the expectations you have for this vs the presets you have in the top-level
presets
array. As it is, thistest
env will just run both sets of presets. What specifically is the goal of thetest
env here? It'll add a few extra plugins around styling and react it looks like, but it also doubles up on a ton of the stuff you're already specifying in the top level config.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this should probably be broken out into
.babelrc
in thetest
directory. Will do that after this PR lands. Since it's not directly related to babel 7 👍