mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-09-11 14:46:37 +03:00
Update webpack and change Babel settings
Summary: Release notes: Prepack now ships Node 6.1+ compatible source This PR does four things: - updates webpack to v4 - changes our Babel presets so we now transpile far less code, in fact we now target node 6.1+ min (as we already specified in package.json). The bundle created for the REPL still targets ES5. - updated eslint - updated circleci node version to 9.7.1 (yarn says it doesn't support it, but there appears to be no issues) This should improve runtime performance and make debugging easier. In fact, there's no real need for sourcemaps now, as the code looks almost identical minus module references. Performance comparisons: Before: <img width="550" alt="screen shot 2018-03-04 at 8 34 10 pm" src="https://user-images.githubusercontent.com/1519870/36957766-9ddb8da4-1feb-11e8-89df-c5e6236fa502.png"> After: <img width="550" alt="screen shot 2018-03-04 at 8 34 22 pm" src="https://user-images.githubusercontent.com/1519870/36957768-a0801cd2-1feb-11e8-8f4e-727ce7f38fb9.png"> Before: <img width="554" alt="screen shot 2018-03-04 at 8 35 07 pm" src="https://user-images.githubusercontent.com/1519870/36957769-a21ded94-1feb-11e8-8362-b4faba66bc48.png"> After: <img width="550" alt="screen shot 2018-03-04 at 8 35 13 pm" src="https://user-images.githubusercontent.com/1519870/36957771-a3e2f1ba-1feb-11e8-92dd-134c613f0282.png"> Before: <img width="691" alt="screen shot 2018-03-04 at 8 43 23 pm" src="https://user-images.githubusercontent.com/1519870/36957902-bd66a266-1fec-11e8-84ee-0d1466c64e32.png"> After: <img width="681" alt="screen shot 2018-03-04 at 8 43 16 pm" src="https://user-images.githubusercontent.com/1519870/36957904-c11aa75e-1fec-11e8-8036-c7ad17f5dafd.png"> Closes https://github.com/facebook/prepack/pull/1532 Reviewed By: sophiebits Differential Revision: D7156411 Pulled By: trueadm fbshipit-source-id: 94f5411e4e849d0577555788ddcd7982912f3176
This commit is contained in:
parent
4b9858f84b
commit
8a61c0c929
11
.babelrc
11
.babelrc
@ -1,9 +1,16 @@
|
||||
{
|
||||
"presets": [
|
||||
"env",
|
||||
"react"
|
||||
["env", {
|
||||
"targets": {
|
||||
"node": "6.10"
|
||||
}
|
||||
}]
|
||||
],
|
||||
"plugins": [
|
||||
"syntax-jsx",
|
||||
"transform-flow-strip-types",
|
||||
"transform-react-jsx",
|
||||
"transform-react-display-name",
|
||||
"transform-class-properties",
|
||||
"transform-object-rest-spread"
|
||||
]
|
||||
|
@ -11,10 +11,6 @@
|
||||
"prettier"
|
||||
],
|
||||
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
|
||||
"env": {
|
||||
"es6": true,
|
||||
"jasmine": true,
|
||||
|
@ -1,6 +1,6 @@
|
||||
machine:
|
||||
node:
|
||||
version: 8.8.1
|
||||
version: 9.7.1
|
||||
environment:
|
||||
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
|
||||
|
||||
|
11
package.json
11
package.json
@ -25,7 +25,7 @@
|
||||
"scripts": {
|
||||
"build": "babel src --out-dir lib --source-maps && yarn build-bundle",
|
||||
"build-scripts": "babel scripts --out-dir lib --source-maps",
|
||||
"build-bundle": "webpack",
|
||||
"build-bundle": "webpack-cli",
|
||||
"watch": "babel src scripts --out-dir lib --watch --source-maps",
|
||||
"lint": "eslint src scripts",
|
||||
"flow": "flow check",
|
||||
@ -74,15 +74,16 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.18.0",
|
||||
"babel-eslint": "^7.1.1",
|
||||
"babel-eslint": "^8.2.2",
|
||||
"babel-helper-function-name": "^6.8.0",
|
||||
"babel-helper-get-function-arity": "^6.8.0",
|
||||
"babel-loader": "^7.1.3",
|
||||
"babel-plugin-transform-class-properties": "^6.6.0",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.8.0",
|
||||
"babel-preset-env": "^1.4.0",
|
||||
"babel-preset-react": "^6.5.0",
|
||||
"chalk": "^1.1.3",
|
||||
"eslint": "^3.8.1",
|
||||
"eslint": "^4.18.2",
|
||||
"eslint-plugin-babel": "^3.3.0",
|
||||
"eslint-plugin-flow-header": "^0.1.1",
|
||||
"eslint-plugin-flowtype": "^2.20.0",
|
||||
@ -108,8 +109,8 @@
|
||||
"remap-istanbul": "^0.9.1",
|
||||
"source-map-support": "^0.4.6",
|
||||
"test262-integrator": "^1.2.0",
|
||||
"uglify-js": "^2.6.2",
|
||||
"webpack": "^2.3.3"
|
||||
"webpack": "^4.1.0",
|
||||
"webpack-cli": "^2.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.1.0"
|
||||
|
@ -7,22 +7,33 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const path = require("path");
|
||||
|
||||
const WebpackConfig = {
|
||||
entry: "./",
|
||||
output: {
|
||||
path: path.join(__dirname),
|
||||
filename: "prepack.min.js",
|
||||
library: 'Prepack',
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
sourceMap: false,
|
||||
})
|
||||
entry: "./",
|
||||
output: {
|
||||
path: path.join(__dirname),
|
||||
filename: "prepack.min.js",
|
||||
library: "Prepack",
|
||||
},
|
||||
mode: "production",
|
||||
optimization: {
|
||||
minimize: true,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
use: {
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
presets: ["env"],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = WebpackConfig;
|
||||
|
Loading…
Reference in New Issue
Block a user