prepack/webpack.config.js

40 lines
796 B
JavaScript
Raw Normal View History

/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
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
2018-03-06 07:52:03 +03:00
const path = require("path");
process.env.NODE_ENV = "production";
const WebpackConfig = {
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
2018-03-06 07:52:03 +03:00
entry: "./",
output: {
path: path.join(__dirname),
filename: "prepack.min.js",
library: "Prepack",
},
parallelism: 1,
profile: true,
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
2018-03-06 07:52:03 +03:00
mode: "production",
optimization: {
minimize: true,
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: "babel-loader",
},
},
],
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
2018-03-06 07:52:03 +03:00
},
};
module.exports = WebpackConfig;