-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const path = require("path"); | ||
|
||
module.exports = { | ||
watchPathIgnorePatterns: [ | ||
path.resolve(__dirname, "build") | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import b from "./b.js"; | ||
|
||
const message = import("./c.js").then(c => c.default + b); | ||
|
||
export default message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "Hello world"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
watch: () => {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
const webpack = require("webpack"); | ||
|
||
const payloads = [ | ||
{ | ||
entry: "/src/fixtures/webpack/a.js" | ||
} | ||
].map(({ entry }, i) => ({ | ||
entry, | ||
output: { | ||
path: "/dist/webpack/", | ||
filename: `bundle.${i}.js` | ||
}, | ||
// Using bail option in order to receive noisy errors in the benchmark if something went wrong | ||
bail: true, | ||
// We need to define that because Firefox has a Object.prototype.watch function | ||
watch: false | ||
})); | ||
|
||
module.exports = { | ||
name: "webpack", | ||
defer: true, | ||
fn(deferred) { | ||
return Promise.all( | ||
payloads.map( | ||
config => | ||
new Promise((resolve, reject) => { | ||
const compiler = webpack(config); | ||
compiler.run((err, stats) => void (err ? reject(err) : resolve())); | ||
}) | ||
) | ||
).then(() => deferred.resolve()); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
const path = require("path"); | ||
const webpack = require("webpack"); | ||
const webpackConfig = require("../webpack.config.js"); | ||
|
||
const outputFile = path.resolve( | ||
__dirname, | ||
"..", | ||
"build", | ||
"webpack-benchmark.test.js" | ||
); | ||
let webpackBenchmark; | ||
|
||
beforeAll( | ||
() => | ||
new Promise((resolve, reject) => { | ||
const baseConfig = webpackConfig[0]; | ||
const config = Object.assign({}, baseConfig, { | ||
entry: require.resolve("./webpack-benchmark.js"), | ||
bail: true | ||
}); | ||
config.output = Object.assign({}, baseConfig.output, { | ||
libraryTarget: "commonjs2", | ||
path: path.dirname(outputFile), | ||
filename: path.basename(outputFile) | ||
}); | ||
const compiler = webpack(config); | ||
compiler.run(err => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
webpackBenchmark = require(outputFile); | ||
resolve(); | ||
}); | ||
}) | ||
); | ||
|
||
it("webpack runs to completion", () => | ||
new Promise(resolve => { | ||
webpackBenchmark.fn({ resolve }); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters