fix prettierignore file and run prettier
This commit is contained in:
parent
75c2784bc5
commit
75a9a515fd
|
@ -1,8 +1,8 @@
|
||||||
# Ignore test fixtures
|
# Ignore test fixtures
|
||||||
test
|
test/*.*
|
||||||
!test/*.js
|
!test/*.js
|
||||||
!test/**/webpack.config.js
|
!test/**/webpack.config.js
|
||||||
|
|
||||||
# Ignore example fixtures
|
# Ignore example fixtures
|
||||||
examples
|
examples/*.*
|
||||||
!examples/**/webpack.config.js
|
!examples/**/webpack.config.js
|
||||||
|
|
|
@ -279,63 +279,57 @@ describe("BenchmarkTestCases", function() {
|
||||||
describe(`${testName} create benchmarks`, function() {
|
describe(`${testName} create benchmarks`, function() {
|
||||||
baselines.forEach(baseline => {
|
baselines.forEach(baseline => {
|
||||||
let baselineStats = null;
|
let baselineStats = null;
|
||||||
it(
|
it(`should benchmark ${baseline.name} (${
|
||||||
`should benchmark ${baseline.name} (${baseline.rev})`,
|
baseline.rev
|
||||||
function(done) {
|
})`, function(done) {
|
||||||
const outputDirectory = path.join(
|
const outputDirectory = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
"js",
|
"js",
|
||||||
"benchmark",
|
"benchmark",
|
||||||
`baseline-${baseline.name}`,
|
`baseline-${baseline.name}`,
|
||||||
testName
|
testName
|
||||||
);
|
);
|
||||||
const config =
|
const config =
|
||||||
Object.create(
|
Object.create(
|
||||||
require.requireActual(
|
|
||||||
path.join(testDirectory, "webpack.config.js")
|
|
||||||
)
|
|
||||||
) || {};
|
|
||||||
config.output = Object.create(config.output || {});
|
|
||||||
if (!config.context) config.context = testDirectory;
|
|
||||||
if (!config.output.path) config.output.path = outputDirectory;
|
|
||||||
runBenchmark(baseline.webpack, config, (err, stats) => {
|
|
||||||
if (err) return done(err);
|
|
||||||
process.stderr.write(` ${baseline.name} ${stats.text}`);
|
|
||||||
if (baseline.name === "HEAD") headStats = stats;
|
|
||||||
else baselineStats = stats;
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
180000
|
|
||||||
);
|
|
||||||
|
|
||||||
it(
|
|
||||||
`should benchmark ${baseline.name} (${baseline.rev})`,
|
|
||||||
done => {
|
|
||||||
const outputDirectory = path.join(
|
|
||||||
__dirname,
|
|
||||||
"js",
|
|
||||||
"benchmark",
|
|
||||||
`baseline-${baseline.name}`,
|
|
||||||
testName
|
|
||||||
);
|
|
||||||
const config =
|
|
||||||
require.requireActual(
|
require.requireActual(
|
||||||
path.join(testDirectory, "webpack.config.js")
|
path.join(testDirectory, "webpack.config.js")
|
||||||
) || {};
|
)
|
||||||
config.output = config.output || {};
|
) || {};
|
||||||
if (!config.context) config.context = testDirectory;
|
config.output = Object.create(config.output || {});
|
||||||
if (!config.output.path) config.output.path = outputDirectory;
|
if (!config.context) config.context = testDirectory;
|
||||||
runBenchmark(baseline.webpack, config, (err, stats) => {
|
if (!config.output.path) config.output.path = outputDirectory;
|
||||||
if (err) return done(err);
|
runBenchmark(baseline.webpack, config, (err, stats) => {
|
||||||
process.stderr.write(` ${baseline.name} ${stats.text}`);
|
if (err) return done(err);
|
||||||
if (baseline.name === "HEAD") headStats = stats;
|
process.stderr.write(` ${baseline.name} ${stats.text}`);
|
||||||
else baselineStats = stats;
|
if (baseline.name === "HEAD") headStats = stats;
|
||||||
done();
|
else baselineStats = stats;
|
||||||
});
|
done();
|
||||||
},
|
});
|
||||||
180000
|
}, 180000);
|
||||||
);
|
|
||||||
|
it(`should benchmark ${baseline.name} (${baseline.rev})`, done => {
|
||||||
|
const outputDirectory = path.join(
|
||||||
|
__dirname,
|
||||||
|
"js",
|
||||||
|
"benchmark",
|
||||||
|
`baseline-${baseline.name}`,
|
||||||
|
testName
|
||||||
|
);
|
||||||
|
const config =
|
||||||
|
require.requireActual(
|
||||||
|
path.join(testDirectory, "webpack.config.js")
|
||||||
|
) || {};
|
||||||
|
config.output = config.output || {};
|
||||||
|
if (!config.context) config.context = testDirectory;
|
||||||
|
if (!config.output.path) config.output.path = outputDirectory;
|
||||||
|
runBenchmark(baseline.webpack, config, (err, stats) => {
|
||||||
|
if (err) return done(err);
|
||||||
|
process.stderr.write(` ${baseline.name} ${stats.text}`);
|
||||||
|
if (baseline.name === "HEAD") headStats = stats;
|
||||||
|
else baselineStats = stats;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
}, 180000);
|
||||||
|
|
||||||
if (baseline.name !== "HEAD") {
|
if (baseline.name !== "HEAD") {
|
||||||
it(`HEAD should not be slower than ${baseline.name} (${
|
it(`HEAD should not be slower than ${baseline.name} (${
|
||||||
|
|
|
@ -503,9 +503,9 @@ describe("Compiler", () => {
|
||||||
output: {
|
output: {
|
||||||
path: "/",
|
path: "/",
|
||||||
filename: "bundle.js"
|
filename: "bundle.js"
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
compiler.hooks.failed.tap('CompilerTest', failedSpy);
|
compiler.hooks.failed.tap("CompilerTest", failedSpy);
|
||||||
compiler.outputFileSystem = new MemoryFs();
|
compiler.outputFileSystem = new MemoryFs();
|
||||||
compiler.run((err, stats) => {
|
compiler.run((err, stats) => {
|
||||||
expect(err).toBeTruthy();
|
expect(err).toBeTruthy();
|
||||||
|
|
|
@ -58,14 +58,16 @@ describe("SourceMapDevToolModuleOptionsPlugin", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("with line-to-line true", () => {
|
describe("with line-to-line true", () => {
|
||||||
beforeEach(() =>
|
beforeEach(
|
||||||
(eventBindings = applyPluginWithOptions(
|
() =>
|
||||||
SourceMapDevToolModuleOptionsPlugin,
|
(eventBindings = applyPluginWithOptions(
|
||||||
{
|
SourceMapDevToolModuleOptionsPlugin,
|
||||||
module: false,
|
{
|
||||||
lineToLine: true
|
module: false,
|
||||||
}
|
lineToLine: true
|
||||||
)));
|
}
|
||||||
|
))
|
||||||
|
);
|
||||||
|
|
||||||
it("binds one event handler", () => {
|
it("binds one event handler", () => {
|
||||||
expect(eventBindings.length).toBe(1);
|
expect(eventBindings.length).toBe(1);
|
||||||
|
|
|
@ -4,11 +4,28 @@
|
||||||
const Stats = require("../lib/Stats");
|
const Stats = require("../lib/Stats");
|
||||||
const packageJson = require("../package.json");
|
const packageJson = require("../package.json");
|
||||||
|
|
||||||
describe(
|
describe("Stats", () => {
|
||||||
"Stats",
|
describe("formatFilePath", () => {
|
||||||
() => {
|
it("emit the file path and request", () => {
|
||||||
describe("formatFilePath", () => {
|
const mockStats = new Stats({
|
||||||
it("emit the file path and request", () => {
|
children: [],
|
||||||
|
errors: ["firstError"],
|
||||||
|
hash: "1234",
|
||||||
|
compiler: {
|
||||||
|
context: ""
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const inputPath =
|
||||||
|
"./node_modules/ts-loader!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/app.vue";
|
||||||
|
const expectPath = `./src/app.vue (${inputPath})`;
|
||||||
|
|
||||||
|
expect(mockStats.formatFilePath(inputPath)).toBe(expectPath);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Error Handling", () => {
|
||||||
|
describe("does have", () => {
|
||||||
|
it("hasErrors", () => {
|
||||||
const mockStats = new Stats({
|
const mockStats = new Stats({
|
||||||
children: [],
|
children: [],
|
||||||
errors: ["firstError"],
|
errors: ["firstError"],
|
||||||
|
@ -17,193 +34,172 @@ describe(
|
||||||
context: ""
|
context: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const inputPath =
|
expect(mockStats.hasErrors()).toBe(true);
|
||||||
"./node_modules/ts-loader!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/app.vue";
|
|
||||||
const expectPath = `./src/app.vue (${inputPath})`;
|
|
||||||
|
|
||||||
expect(mockStats.formatFilePath(inputPath)).toBe(expectPath);
|
|
||||||
});
|
});
|
||||||
});
|
it("hasWarnings", () => {
|
||||||
|
|
||||||
describe("Error Handling", () => {
|
|
||||||
describe("does have", () => {
|
|
||||||
it("hasErrors", () => {
|
|
||||||
const mockStats = new Stats({
|
|
||||||
children: [],
|
|
||||||
errors: ["firstError"],
|
|
||||||
hash: "1234",
|
|
||||||
compiler: {
|
|
||||||
context: ""
|
|
||||||
}
|
|
||||||
});
|
|
||||||
expect(mockStats.hasErrors()).toBe(true);
|
|
||||||
});
|
|
||||||
it("hasWarnings", () => {
|
|
||||||
const mockStats = new Stats({
|
|
||||||
children: [],
|
|
||||||
warnings: ["firstError"],
|
|
||||||
hash: "1234",
|
|
||||||
compiler: {
|
|
||||||
context: ""
|
|
||||||
}
|
|
||||||
});
|
|
||||||
expect(mockStats.hasWarnings()).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("does not have", () => {
|
|
||||||
it("hasErrors", () => {
|
|
||||||
const mockStats = new Stats({
|
|
||||||
children: [],
|
|
||||||
errors: [],
|
|
||||||
hash: "1234",
|
|
||||||
compiler: {
|
|
||||||
context: ""
|
|
||||||
}
|
|
||||||
});
|
|
||||||
expect(mockStats.hasErrors()).toBe(false);
|
|
||||||
});
|
|
||||||
it("hasWarnings", () => {
|
|
||||||
const mockStats = new Stats({
|
|
||||||
children: [],
|
|
||||||
warnings: [],
|
|
||||||
hash: "1234",
|
|
||||||
compiler: {
|
|
||||||
context: ""
|
|
||||||
}
|
|
||||||
});
|
|
||||||
expect(mockStats.hasWarnings()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("children have", () => {
|
|
||||||
it("hasErrors", () => {
|
|
||||||
const mockStats = new Stats({
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
getStats: () =>
|
|
||||||
new Stats({
|
|
||||||
errors: ["firstError"],
|
|
||||||
hash: "5678"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
],
|
|
||||||
errors: [],
|
|
||||||
hash: "1234"
|
|
||||||
});
|
|
||||||
expect(mockStats.hasErrors()).toBe(true);
|
|
||||||
});
|
|
||||||
it("hasWarnings", () => {
|
|
||||||
const mockStats = new Stats({
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
getStats: () =>
|
|
||||||
new Stats({
|
|
||||||
warnings: ["firstError"],
|
|
||||||
hash: "5678"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
],
|
|
||||||
warnings: [],
|
|
||||||
hash: "1234"
|
|
||||||
});
|
|
||||||
expect(mockStats.hasWarnings()).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it("formatError handles string errors", () => {
|
|
||||||
const mockStats = new Stats({
|
const mockStats = new Stats({
|
||||||
errors: ["firstError"],
|
|
||||||
warnings: [],
|
|
||||||
assets: [],
|
|
||||||
entrypoints: new Map(),
|
|
||||||
namedChunkGroups: new Map(),
|
|
||||||
chunks: [],
|
|
||||||
modules: [],
|
|
||||||
children: [],
|
children: [],
|
||||||
|
warnings: ["firstError"],
|
||||||
hash: "1234",
|
hash: "1234",
|
||||||
mainTemplate: {
|
|
||||||
outputOptions: {
|
|
||||||
path: ""
|
|
||||||
},
|
|
||||||
getPublicPath: () => "path"
|
|
||||||
},
|
|
||||||
compiler: {
|
compiler: {
|
||||||
context: ""
|
context: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const obj = mockStats.toJson();
|
expect(mockStats.hasWarnings()).toBe(true);
|
||||||
expect(obj.errors[0]).toEqual("firstError");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("toJson", () => {
|
describe("does not have", () => {
|
||||||
it("returns plain object representation", () => {
|
it("hasErrors", () => {
|
||||||
const mockStats = new Stats({
|
const mockStats = new Stats({
|
||||||
errors: [],
|
|
||||||
warnings: [],
|
|
||||||
assets: [],
|
|
||||||
entrypoints: new Map(),
|
|
||||||
chunks: [],
|
|
||||||
namedChunkGroups: new Map(),
|
|
||||||
modules: [],
|
|
||||||
children: [],
|
children: [],
|
||||||
|
errors: [],
|
||||||
hash: "1234",
|
hash: "1234",
|
||||||
mainTemplate: {
|
|
||||||
outputOptions: {
|
|
||||||
path: "/"
|
|
||||||
},
|
|
||||||
getPublicPath: () => "path"
|
|
||||||
},
|
|
||||||
compiler: {
|
compiler: {
|
||||||
context: ""
|
context: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const result = mockStats.toJson();
|
expect(mockStats.hasErrors()).toBe(false);
|
||||||
expect(result).toEqual({
|
});
|
||||||
assets: [],
|
it("hasWarnings", () => {
|
||||||
assetsByChunkName: {},
|
const mockStats = new Stats({
|
||||||
children: [],
|
children: [],
|
||||||
chunks: [],
|
warnings: [],
|
||||||
entrypoints: {},
|
|
||||||
namedChunkGroups: {},
|
|
||||||
filteredAssets: 0,
|
|
||||||
filteredModules: 0,
|
|
||||||
errors: [],
|
|
||||||
hash: "1234",
|
hash: "1234",
|
||||||
modules: [],
|
compiler: {
|
||||||
outputPath: "/",
|
context: ""
|
||||||
publicPath: "path",
|
}
|
||||||
version: packageJson.version,
|
|
||||||
warnings: []
|
|
||||||
});
|
});
|
||||||
|
expect(mockStats.hasWarnings()).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("Presets", () => {
|
describe("children have", () => {
|
||||||
describe("presetToOptions", () => {
|
it("hasErrors", () => {
|
||||||
it("returns correct object with 'Normal'", () => {
|
const mockStats = new Stats({
|
||||||
expect(Stats.presetToOptions("Normal")).toEqual({});
|
children: [
|
||||||
|
{
|
||||||
|
getStats: () =>
|
||||||
|
new Stats({
|
||||||
|
errors: ["firstError"],
|
||||||
|
hash: "5678"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
],
|
||||||
|
errors: [],
|
||||||
|
hash: "1234"
|
||||||
});
|
});
|
||||||
it("truthy values behave as 'normal'", () => {
|
expect(mockStats.hasErrors()).toBe(true);
|
||||||
const normalOpts = Stats.presetToOptions("normal");
|
});
|
||||||
expect(Stats.presetToOptions("pizza")).toEqual(normalOpts);
|
it("hasWarnings", () => {
|
||||||
expect(Stats.presetToOptions(true)).toEqual(normalOpts);
|
const mockStats = new Stats({
|
||||||
expect(Stats.presetToOptions(1)).toEqual(normalOpts);
|
children: [
|
||||||
|
{
|
||||||
|
getStats: () =>
|
||||||
|
new Stats({
|
||||||
|
warnings: ["firstError"],
|
||||||
|
hash: "5678"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
],
|
||||||
|
warnings: [],
|
||||||
|
hash: "1234"
|
||||||
|
});
|
||||||
|
expect(mockStats.hasWarnings()).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it("formatError handles string errors", () => {
|
||||||
|
const mockStats = new Stats({
|
||||||
|
errors: ["firstError"],
|
||||||
|
warnings: [],
|
||||||
|
assets: [],
|
||||||
|
entrypoints: new Map(),
|
||||||
|
namedChunkGroups: new Map(),
|
||||||
|
chunks: [],
|
||||||
|
modules: [],
|
||||||
|
children: [],
|
||||||
|
hash: "1234",
|
||||||
|
mainTemplate: {
|
||||||
|
outputOptions: {
|
||||||
|
path: ""
|
||||||
|
},
|
||||||
|
getPublicPath: () => "path"
|
||||||
|
},
|
||||||
|
compiler: {
|
||||||
|
context: ""
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const obj = mockStats.toJson();
|
||||||
|
expect(obj.errors[0]).toEqual("firstError");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("toJson", () => {
|
||||||
|
it("returns plain object representation", () => {
|
||||||
|
const mockStats = new Stats({
|
||||||
|
errors: [],
|
||||||
|
warnings: [],
|
||||||
|
assets: [],
|
||||||
|
entrypoints: new Map(),
|
||||||
|
chunks: [],
|
||||||
|
namedChunkGroups: new Map(),
|
||||||
|
modules: [],
|
||||||
|
children: [],
|
||||||
|
hash: "1234",
|
||||||
|
mainTemplate: {
|
||||||
|
outputOptions: {
|
||||||
|
path: "/"
|
||||||
|
},
|
||||||
|
getPublicPath: () => "path"
|
||||||
|
},
|
||||||
|
compiler: {
|
||||||
|
context: ""
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const result = mockStats.toJson();
|
||||||
|
expect(result).toEqual({
|
||||||
|
assets: [],
|
||||||
|
assetsByChunkName: {},
|
||||||
|
children: [],
|
||||||
|
chunks: [],
|
||||||
|
entrypoints: {},
|
||||||
|
namedChunkGroups: {},
|
||||||
|
filteredAssets: 0,
|
||||||
|
filteredModules: 0,
|
||||||
|
errors: [],
|
||||||
|
hash: "1234",
|
||||||
|
modules: [],
|
||||||
|
outputPath: "/",
|
||||||
|
publicPath: "path",
|
||||||
|
version: packageJson.version,
|
||||||
|
warnings: []
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("Presets", () => {
|
||||||
|
describe("presetToOptions", () => {
|
||||||
|
it("returns correct object with 'Normal'", () => {
|
||||||
|
expect(Stats.presetToOptions("Normal")).toEqual({});
|
||||||
|
});
|
||||||
|
it("truthy values behave as 'normal'", () => {
|
||||||
|
const normalOpts = Stats.presetToOptions("normal");
|
||||||
|
expect(Stats.presetToOptions("pizza")).toEqual(normalOpts);
|
||||||
|
expect(Stats.presetToOptions(true)).toEqual(normalOpts);
|
||||||
|
expect(Stats.presetToOptions(1)).toEqual(normalOpts);
|
||||||
|
|
||||||
expect(Stats.presetToOptions("verbose")).not.toEqual(normalOpts);
|
expect(Stats.presetToOptions("verbose")).not.toEqual(normalOpts);
|
||||||
expect(Stats.presetToOptions(false)).not.toEqual(normalOpts);
|
expect(Stats.presetToOptions(false)).not.toEqual(normalOpts);
|
||||||
});
|
});
|
||||||
it("returns correct object with 'none'", () => {
|
it("returns correct object with 'none'", () => {
|
||||||
expect(Stats.presetToOptions("none")).toEqual({
|
expect(Stats.presetToOptions("none")).toEqual({
|
||||||
all: false
|
all: false
|
||||||
});
|
|
||||||
});
|
|
||||||
it("falsy values behave as 'none'", () => {
|
|
||||||
const noneOpts = Stats.presetToOptions("none");
|
|
||||||
expect(Stats.presetToOptions("")).toEqual(noneOpts);
|
|
||||||
expect(Stats.presetToOptions(null)).toEqual(noneOpts);
|
|
||||||
expect(Stats.presetToOptions()).toEqual(noneOpts);
|
|
||||||
expect(Stats.presetToOptions(0)).toEqual(noneOpts);
|
|
||||||
expect(Stats.presetToOptions(false)).toEqual(noneOpts);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it("falsy values behave as 'none'", () => {
|
||||||
|
const noneOpts = Stats.presetToOptions("none");
|
||||||
|
expect(Stats.presetToOptions("")).toEqual(noneOpts);
|
||||||
|
expect(Stats.presetToOptions(null)).toEqual(noneOpts);
|
||||||
|
expect(Stats.presetToOptions()).toEqual(noneOpts);
|
||||||
|
expect(Stats.presetToOptions(0)).toEqual(noneOpts);
|
||||||
|
expect(Stats.presetToOptions(false)).toEqual(noneOpts);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
10000
|
}, 10000);
|
||||||
);
|
|
||||||
|
|
|
@ -7,9 +7,7 @@ module.exports = {
|
||||||
output: {
|
output: {
|
||||||
filename: "[name].js"
|
filename: "[name].js"
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [new IgnorePlugin(/intentionally-missing-module/)],
|
||||||
new IgnorePlugin(/intentionally-missing-module/)
|
|
||||||
],
|
|
||||||
node: {
|
node: {
|
||||||
__dirname: false
|
__dirname: false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const Compiler = require('../../../../lib/Compiler');
|
const Compiler = require("../../../../lib/Compiler");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
optimization: {
|
optimization: {
|
||||||
|
@ -7,12 +7,12 @@ module.exports = {
|
||||||
{
|
{
|
||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
expect(compiler).toBeInstanceOf(Compiler);
|
expect(compiler).toBeInstanceOf(Compiler);
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
function(compiler) {
|
function(compiler) {
|
||||||
expect(compiler).toBe(this);
|
expect(compiler).toBe(this);
|
||||||
expect(compiler).toBeInstanceOf(Compiler);
|
expect(compiler).toBeInstanceOf(Compiler);
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -103,5 +103,5 @@ module.exports = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stats
|
stats
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -8,12 +8,9 @@ const valueFile = path.resolve(
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
TEST_VALUE: webpack.DefinePlugin.runtimeValue(
|
TEST_VALUE: webpack.DefinePlugin.runtimeValue(() => {
|
||||||
() => {
|
return JSON.stringify(fs.readFileSync(valueFile, "utf-8").trim());
|
||||||
return JSON.stringify(fs.readFileSync(valueFile, "utf-8").trim());
|
}, [valueFile]),
|
||||||
},
|
|
||||||
[valueFile]
|
|
||||||
),
|
|
||||||
TEST_VALUE2: webpack.DefinePlugin.runtimeValue(() => {
|
TEST_VALUE2: webpack.DefinePlugin.runtimeValue(() => {
|
||||||
return JSON.stringify(fs.readFileSync(valueFile, "utf-8").trim());
|
return JSON.stringify(fs.readFileSync(valueFile, "utf-8").trim());
|
||||||
}, []),
|
}, []),
|
||||||
|
|
Loading…
Reference in New Issue