text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>f0-9]+\.png" alt="image">/);
});
it("should still expose the rewritten HTML as the module's default export", () => {
expect(typeof page).toBe("string");
// Same content as the emitted file.
expect(page).toBe(readFile("page.html"));
});
<|fim_prefix|>const fs = require("fs");
const path = require("path... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const fs = require("fs");
// `output.filename` is `[name].js` so the test entry bundle lives at
// `main.js`, not `bundle0.js`. Tell the harness whe<|fim_suffix|>le.exports = {
findBundle(_i, options) {
const files = fs.readdirSync(options.output.path);
return files.includes("main.js"... | fim | webpack/webpack | javascript |
<|fim_suffix|>ion: {
chunkIds: "named"
},
module: {
generator: {
html: {
extract: true
}
}
},
experiments: {
html: true
}
};
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
output: {
filename: "[name].js",
chunkFilename: "[name<|fim_middle|... | fim | webpack/webpack | javascript |
<|fim_suffix|>
// otherwise the browser would look for `pages/<hash>.png` instead of
// `<hash>.png`.
expect(html).not.toContain('src="./image.png"');
expect(html).toMatch(/<img src="\.\.\/[a-f0-9]+\.png" alt="image">/);
});
<|fim_prefix|>const fs = require("fs");
const path = require("path");
require("./page.html... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const fs = require("fs");
module.exports = {
findBundle(_i, options) {
const files = fs.readdirSync(options.output.path);
return files.includes("main.js") ? ["./main.js"] : undefine<|fim_suffix|> }
};
<|fim_middle|>d;
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>tenthash:8].html",
htmlChunkFilename: "pages/[name].[contenthash:8].html",
// `publicPath: "auto"` is required for the undo-path test below to
// kick in β that's the mode where asset/chunk URLs in the rewritten
// HTML carry a placeholder that's resolved relative to the emitted
// HTML's locati... | fim | webpack/webpack | javascript |
<|fim_suffix|><|fim_prefix|>module.export<|fim_middle|>s = "entry";
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>Match(
/<script[^>]*\bsrc="[^"]*html-runtime\.js"[^>]*\bintegrity=/
);
// The original entry tag keeps its own integrity attribute untouched.
expect(extracted).toMatch(
/<script[^>]*\bsrc="[^"]*__html_[^"]+\.chunk\.js"[^>]*\bintegrity="sha384-IGNOREME"/
);
});
<|fim_prefix|>const fs = require("fs"... | fim | webpack/webpack | javascript |
<|fim_suffix|>her";
<|fim_prefix|>module.exports = "<|fim_middle|>ot<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const fs<|fim_suffix|>s = {
findBundle(_i, options) {
const files = fs.readdirSync(options.output.path);
return files.includes("main.js") ? ["./main.js"] : undefined;
}
};
<|fim_middle|> = require("fs");
// `output.filename` is `[name].js` so the test entry bundle lives at
// `main.j... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
// Combines `extract: true` with `optimization.runtimeChunk` targeting only
// the synthetic entries that HtmlModulesPlugin creates for `<script src>`
// references. The extracted HTML must reference both the split-out runtime
// chunk and the entry chunk β otherwise th<|fim_suffix|> experi... | fim | webpack/webpack | javascript |
var vendor = require("./vendor");
module.exports = "entry:" + vendor;
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>d of String.prototype.matchAll for
// compatibility with legacy Node.js.
const scriptSrcRe = /<script src="([^"]+)">/g;
const scriptSrcMatches = [];
for (let m; (m = scriptSrcRe.exec(extracted)); ) scriptSrcMatches.push(m[1]);
// One tag per chunk in the entry's chunk group: vendor + entry.
expect(s... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const fs = require("fs");
// `output.filename` is `[name].js` so the test entry bundle lives at
// `main.js`, not `bund<|fim_suffix|>((f) => f === "vendor.js");
return vendor ? [`./${vendor}`, "./main.js"] : ["./main.js"];
}
};
<|fim_middle|>le0.js`. Tell the harness where to find it; w... | fim | webpack/webpack | javascript |
<|fim_suffix|>rts = "vendor-module";
<|fim_prefix|>module.<|fim_middle|>expo<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
// Force the entry's heavy dependency into a separate chunk via
// `optimization.splitChunks`. The extracted HTML must include a script tag
// for the split-out vendor chunk in addition to the entry chunk so the
// browser loads both.
/** @type {import("../../../../").Configuration} */
mod... | fim | webpack/webpack | javascript |
<|fim_prefix|>import page from "./page.html";
it("should compile a kitchen-sink HTML document through all lexer states", () => {
expect(typeof<|fim_suffix|>.toBe("string");
expect(page).toMatchSnapshot();
});
<|fim_middle|> page)<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>{
target: "web",
experiments: {
html: true
}
};
<|fim_prefix|>"use strict";
/** @typ<|fim_middle|>e {import("../../../../").Configuration} */
module.exports = <|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>module.expo<|fim_suffix|>tml-entry-script";
<|fim_middle|>rts = "h<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>undle() {
return ["./test.js"];
}
};
<|fim_prefix|>"use strict";
// The HTML entry has no top-level `it(...)` body β assertions live in the
// emitted `test.js` asset, which the harness loads directly.
mo<|fim_middle|>dule.exports = {
findB<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>xpect(extracted).toMatch(/<img src="[a-f0-9]+\.png" alt="image">/);
});
<|fim_prefix|>const fs = require("fs");
const path = require("path");
const readFile = (name) =>
fs.readFileS<|fim_middle|>ync(path.resolve(__dirname, name), "utf-8");
it("should emit page.html for an HTML entry without explicit ex... | fim | webpack/webpack | javascript |
<|fim_suffix|> "test.js",
new webpack.sources.RawSource(data)
);
}
);
});
}
}
]
};
<|fim_prefix|>"use strict";
// HTML used directly as a compilation entry. `module.generator.html.extract`
// is left at its default (undefined), which means HtmlGenerator should
// auto-enable ex... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict<|fim_suffix|>ports = {
findBundle() {
return ["./test.js"];
}
};
<|fim_middle|>";
module.ex<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>nk\s+rel="stylesheet"\s+href="([^"]+)"/
);
expect(linkMatch).not.toBeNull();
const cssPath = linkMatch[1];
expect(cssPath).toMatch(/\.css$/);
// The CSS file is on disk and `url()` inside it was resolved to an
// asset module β the original `./image.png` path is gone, replaced
// with the hashed as... | fim | webpack/webpack | javascript |
<|fim_suffix|>s`. The
// `url()` asset URL in the emitted CSS should also be a hashed filename.
const fs = require("fs");
const path = require("path");
const webpack = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
// `target: "web"` makes the default CSS generator em... | fim | webpack/webpack | javascript |
<|fim_prefix|>import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import page from "./page.html";
const here = path.dirname(fileURLToPath(import.meta.url));
const readChunk = (name) => fs.readFileSync(path.resolve(here, name), "utf-8");
// `import page from "./page.html"` always retur... | fim | webpack/webpack | javascript |
<|fim_suffix|>rocess.versions.node.split(".")[0]);
return major >= 12;
};
<|fim_prefix|>"use strict";
// Tests use `import.meta.url` to locate emitted chunks at runtime, which
// requires the bundle to run as a real ES module. Jest's ESM support
// (via `--experimental-vm-modules`) needs Node<|fim_middle|> 12+.
modul... | fim | webpack/webpack | javascript |
"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: ["web", "es2022"],
node: {
__dirname: false,
__filename: false
},
externalsPresets: {
node: true
},
module: {
parser: {
javascript: {
importMeta: false
}
}
},
output: {
chunkFilename: "[name].chun... | fim | webpack/webpack | javascript |
<|fim_prefix|>const fs = require("fs");
const path = require("path");
const page = require("./page.html");
const readChunk = (name) =>
fs.readFileSync(path.resolve(__dirname, name), "utf-8");
// `require("./page.html")` always returns the HTML body as a string, but
// static analysis can't see through the HTML modu... | fim | webpack/webpack | javascript |
<|fim_suffix|>.Configuration} */
module.exports = {
target: "web",
node: {
__dirname: false,
__filename: false
},
externalsPresets: {
node: true
},
output: {
chunkFilename: "[name].chunk.js"
},
optimization: {
chunkIds: "named"
},
experiments: {
html: true
}
};
<|fim_prefix|>"use strict";
// No<... | fim | webpack/webpack | javascript |
import page from "./page.html";
it("should compile and export html as string", () => {
expect(page).toMatchSnapshot();
});
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>rts = {
target: "web",
experiments: {
html: true
}
};
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuratio<|fim_middle|>n} */
module.expo<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import html from "./page.html";
import "./style.css";
it("should work", () => {
const myUrl = new URL("./image.png", import.meta.ur<|fim_suffix|>ml).toMatchSnapshot();
const links = document.getElementsByTagName("link");
const css = [];
// Skip first because import it by default
for (const link of... | fim | webpack/webpack | javascript |
<|fim_suffix|> scope.window.document.createElement("link");
link.rel = "stylesheet";
link.href = `bundle${scope.__STATS_I__}.css`;
scope.window.document.head.appendChild(link);
}
};
<|fim_prefix|>"use strict";
module.exports<|fim_middle|> = {
moduleScope(scope) {
const link =<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>rl)` to locate the
// emitted asset at runtime, which requires the bundle to run as a real
// ES module. Jest's ESM support (via `--experimental-vm-modules`) needs
// Node 12+.
module.exports = function filter() {
const major = Number(process.versions.node.split(".")[0]);
return major >= 12;
};
<|fim_pr... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @t<|fim_suffix|>} */
module.exports = {
target: "web",
output: {
assetModuleFilename: "handled-[name][ext]"
},
experiments: {
html: true,
css: true
}
};
<|fim_middle|>ype {import("../../../../").Configuration<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>s">');
const links = document.getElementsByTagName("link");
const css = [];
// Skip first because import it by default
for (const link of links.slice(1)) {
css.push(link.sheet.css);
}
expect(css).toMatchSnapshot();
});
<|fim_prefix|>import page from "./page.html";
import "./style.css";
import "... | fim | webpack/webpack | javascript |
<|fim_suffix|><|fim_prefix|>export const value = 42;<|fim_middle|>
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
module.exp<|fim_suffix|>st link = scope.window.document.createElement("link");
link.rel = "stylesheet";
link.href = `bundle${scope.__STATS_I__}.css`;
scope.window.document.head.appendChild(link);
}
};
<|fim_middle|>orts = {
moduleScope(scope) {
con<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
devtool: false,
target<|fim_suffix|> "handled-[name][ext]"
},
experiments: {
html: true,
css: true
}
};
<|fim_middle|>: "web",
output: {
assetModuleFilename:<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import preload fro<|fim_suffix|>}`;
<|fim_middle|>m "./preload.js";
globalThis.__entryResult = `entry: ${preload<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>xperiments.outputModule is on.
expect(preloadChunk).not.toContain("// webpackBootstrap");
expect(preloadChunk).not.toMatch(/^\/\*+\/ \(\(\) => \{/);
expect(preloadChunk).toContain('"preload module"');
const entryChunkName = chunkFor(
/<script type="module" src="(__html_[^"]+\.mjs)">/
);
const ent... | fim | webpack/webpack | javascript |
globalThis.__preloadOtherLoaded = true;
export default "preload-other module";
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>const value = "prel<|fim_suffix|>.__preloadLoaded = true;
export default value;
<|fim_middle|>oad module";
globalThis<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
<|fim_suffix|>};
<|fim_middle|>module.exports = {
findBundle() {
return ["./main.mjs"];
}
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
// Tests use `import.meta.url` to locate emitte<|fim_suffix|> = function filter() {
const major = Number(process.versions.node.split(".")[0]);
return major >= 12;
};
<|fim_middle|>d chunks at runtime and
// `globalThis` in fixtures, both of which require Node 12+.
module.exports<|endoftex... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: ["web", "es2022"],
node: {
__dirname: false,
__filename: false
},
externalsPresets: {
node: true
},
module: {
parser: {
javascript: {
importMeta: false
}
}
},
output: {
filename: "[n... | fim | webpack/webpack | javascript |
<|fim_suffix|>ithout `'...'`, it should be a plain URL rewrite β never a chunk
// entry. That's verified here by the absence of `__html_*` chunk
// names in the rewritten HTML; the custom-source `data-src` /
// `data-srcset` / `data-href` URLs are asset URLs, not script chunks.
expect(page).not.toMatch(/__html_[a-f... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const <|fim_suffix|>;
<|fim_middle|>fs = require("fs");
// `output.filename` is `[name].js` so the test entry bundle lives at
// `main.js`, not `bundle0.js`. Tell the harness where to find it.
module.exports = {
findBundle(_i, options) {
const files = fs.readdirSync(options.output.path)... | fim | webpack/webpack | javascript |
<|fim_suffix|>
},
module: {
parser: {
html: {
sources: [
"...",
{ tag: "img", attribute: "data-src", type: "src" },
{ tag: "img", attribute: "data-srcset", type: "srcset" },
// Omit `tag` to match any element.
{ attribute: "data-href", type: "src" }
]
}
}
},
experiments: {... | fim | webpack/webpack | javascript |
<|fim_suffix|> true;
<|fim_prefix|>globalThis<|fim_middle|>.__classic =<|endoftext|> | fim | webpack/webpack | javascript |
import page from "./page.html";
it("should emit `type=module` <script> siblings for a custom `script` source under output.module", () => {
// The custom element's own `src` is rewritten in place to its entry chunk.
expect(page).toMatch(/<my-script src="__html_[a-f0-9]+_\d+\.chunk\.js">/);
// The split-out runtime c... | fim | webpack/webpack | javascript |
<|fim_suffix|>he harness where to find it.
module.exports = {
findBundle(_i, options) {
const files = fs.readdirSync(options.output.path);
return files.includes("main.js") ? ["./main.js"] : undefined;
}
};
<|fim_prefix|>"use strict";
const fs = require("fs");
// `output.filename` is `[<|fim_middle|>name].js` so... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
// Under `output.module` the emitted chunks are ESM, so a custom element
// mapped to `type: "script"` must get `type="module"` sibling tags for its
// runtime/split chunks β its entry chunk is ESM too, and a classic `<script>`
// sibling would fail to load an ES module. Regression test for... | fim | webpack/webpack | javascript |
<|fim_suffix|>rue;
<|fim_prefix|><|fim_middle|>globalThis.__classic = t<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>sm";
<|fim_prefix|>export const tag = <|fim_middle|>"e<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|> // The split-out runtime chunk is loaded by a *real* classic <script>
// inserted before the custom element β never a clone of <my-script>.
expect(page).toMatch(/<script src="[^"]*-runtime\.js"><\/script>/);
// Exactly one <my-script> tag survives (the original). A cloned sibling
// would show up as ... | fim | webpack/webpack | javascript |
<|fim_suffix|> ? ["./main.js"] : undefined;
}
};
<|fim_prefix|>"use stric<|fim_middle|>t";
const fs = require("fs");
// `output.filename` is `[name].js` so the test entry bundle lives at
// `main.js`, not `bundle0.js`. Tell the harness where to find it.
module.exports = {
findBundle(_i, options) {
const files = f... | fim | webpack/webpack | javascript |
"use strict";
// Regression test for sibling-tag emission when a custom (non-`<script>`)
// element is mapped to a `script` / `script-module` source type. With
// `runtimeChunk` splitting a runtime chunk out of each synthetic html entry,
// the template must emit *real* `<script>` siblings for the extra chunks β
// cl... | fim | webpack/webpack | javascript |
<|fim_suffix|> // to an inherited value and never becomes a chunk entry (the file
// doesn't exist; a bogus entry would fail the build).
expect(page).toContain('name="./proto-bypass.js"');
expect(page).not.toMatch(/__html_[a-f0-9]+_\d+/);
});
it("should still bundle inline <script> bodies when sources is false", ()... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module<|fim_suffix|> "web",
module: {
parser: {
html: {
sources: false
}
}
},
experiments: {
html: true
}
};
<|fim_middle|>.exports = {
target:<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import page from "./page.html";
<|fim_suffix|>ly sources[].filter to conditionally extract URLs", () => {
expect(page).toMatchSnapshot();
});
<|fim_middle|>
it("should app<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
devtool: false,
t<|fim_suffix|>e"
},
{
attribute: "href",
type: "src",
filter: (attrs) => attrs.get("rel") === "icon"
}
]
}
}
},
experiments: {
html: true
}
};
<|fim_middl... | fim | webpack/webpack | javascript |
<|fim_suffix|>`./missing.css`, `./missing.js`, `./missing.png` don't exist; the
// build only succeeds because their attributes aren't in the user's
// sources list and are left untouched.
expect(page).toContain('href="./missing.css"');
expect(page).toContain('src="./missing.js"');
expect(page).toContain('src="./m... | fim | webpack/webpack | javascript |
"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
module: {
parser: {
html: {
// An array without `"..."` opts out of the default source list.
// Only `<img data-src>` is extracted as a webpack dependency;
// `<img src>`, `<link href>`, `<script src>... | fim | webpack/webpack | javascript |
<|fim_suffix|>ta-src="image.png">');
// Defaults are disabled (no "..."), so <img src> stays untouched
expect(page).toContain('<img src="./image.png"');
expect(page).toMatchSnapshot();
});
<|fim_prefix|>import page from "./page.html";
it("should match user-configured sources against adjust<|fim_middle|>ed camelCase... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
devtool: false,
<|fim_suffix|>eignObject", attribute: "data-src", type: "src" }
]
}
}
},
experiments: {
html: true
}
};
<|fim_middle|>target: "web",
output: {
assetModuleFilename: "[name][ext]"
},
mo... | fim | webpack/webpack | javascript |
<|fim_suffix|>__classic = true;
<|fim_prefix|>globalTh<|fim_middle|>is.<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>export co<|fim_suffix|>tag = "esm";
<|fim_middle|>nst <|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import page from "./page.html";
it("should bund<|fim_suffix|>through the CSS
// pipeline, so the rewritten value now carries the pipeline's banner
// header alongside the original CSS text.
expect(page).toMatch(
/<my-style data-css="\/\*![\s\S]*?css data:text\/css[\s\S]*?body \{ color: red; \}\s*"><... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const fs = require("fs");
// `output.filename` is `[name].js` so the test entry bundle lives at
// `main.js`, not `bundle0.js`. Tell the harness whe<|fim_suffix|>;
<|fim_middle|>re to find it.
module.exports = {
findBundle(_i, options) {
const files = fs.readdirSync(options.output.path)... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
output: {
filename: "[name].js",
chunkFilename: "[name].chunk.js",
cssChunkFilename: "[name].chunk.css"
},
optimization: {
chunkIds: "named"
},
module: {
parser: {
html: {
sources: [... | fim | webpack/webpack | javascript |
import page from "./page.html";
it("should run the parser template before parsing the html", () => {
// The template replaces `{{title}}` before the parser runs, so the
// rendered html carries the substituted text and no placeholder is left.
expect(page).toContain("<title>Hello world</title>");
expect(page).not.t... | fim | webpack/webpack | javascript |
<|fim_suffix|>urce);
addContextDependency(require("path").dirname(resource));
addBuildDependency(resource);
return source
.replace(/\{\{title\}\}/g, "Hello world")
.replace(/\{\{image\}\}/g, "./image.png");
}
}
}
},
experiments: {
html: true
}
};
<|fim_prefix|>"use strict";
/**... | fim | webpack/webpack | javascript |
<|fim_prefix|>modu<|fim_suffix|>sic typed entry";
<|fim_middle|>le.exports = "clas<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>xports = "first entry";
<|fim_prefix|><|fim_middle|>module.e<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import page from "./page.html";
const here = path.dirname(fileURLToPath(import.meta.url));
const readChunk = (name) => fs.readFileSync(path.resolve(here, name), "utf-8");
// Document-order list of every script-src chunk... | fim | webpack/webpack | javascript |
<|fim_suffix|>try";
export default value;
<|fim_prefix|>export const value<|fim_middle|> = "module en<|endoftext|> | fim | webpack/webpack | javascript |
module.exports = "second entry";
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>l` to locate emitted chunks at runtime, which
// requires the bundle to run as a real ES module. Jest's ESM support
// (via `--experimental-vm-modules`) needs Node 12+.
module.exports = function filter() {
const major = Number(process.versions.node.split(".")[0]);
return major >= 12;
};
<|fim_prefix|>"u... | fim | webpack/webpack | javascript |
<|fim_suffix|>dirname: false,
__filename: false
},
externalsPresets: {
node: true
},
module: {
parser: {
javascript: {
importMeta: false
}
}
},
output: {
chunkFilename: "[name].chunk.js"
},
optimization: {
chunkIds: "named"
},
experiments: {
html: true,
outputModule: true
}
};
<|fim... | fim | webpack/webpack | javascript |
<|fim_prefix|>module.e<|fim_suffix|> = "classic typed entry";
<|fim_middle|>xports<|endoftext|> | fim | webpack/webpack | javascript |
module.exports = "first entry";
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>moduleChunk).toMatch(/^\/\*+\/ \(\(\) => \{/);
expect(moduleChunk).toContain("// webpackBootstrap");
});
<|fim_prefix|>const fs = require("fs");
const path = require("path");
const page = require("./page.html");
const readChunk = (name) => fs.readFileSync(path.resolve(__dirname, name), "utf-8");
// `S... | fim | webpack/webpack | javascript |
<|fim_suffix|>t default value;
<|fim_prefix|>export const v<|fim_middle|>alue = "module entry";
expor<|endoftext|> | fim | webpack/webpack | javascript |
module.exports = "second entry";
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>: true
}
};
<|fim_prefix|>"use strict";
// No `experiments.outputModule` and no `output.module` β emitted chunks are
// classic IIFE-wrapped scripts. The parser must NOT auto-upgrade
// `<script src>` to `<script type="module" src>` in this mode.
/** @type {import("../../../../").Configuration} */
modu... | fim | webpack/webpack | javascript |
<|fim_prefix|>globalThis.__classicA = "classic-a<|fim_suffix|><|fim_middle|> value";
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>// classic-b loads after classic-a in document order; it reads the global set
// by classic-a (browser execution order) β webpac<|fim_suffix|>B = "classic-b value";
<|fim_middle|>k doesn't link them.
globalThis.__classic<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import page from "./page.html";
const here = path.dirname(fileURLToPath(import.meta.url));
const readChunk = (name) => fs.readFileSync(path.resolve(here, name), "utf-8");
// In this fixture `output.module` is on, so the... | fim | webpack/webpack | javascript |
<|fim_suffix|>moduleA;
<|fim_prefix|>export const moduleA = "module-a value";
globalThi<|fim_middle|>s.__moduleA = <|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>im<|fim_suffix|> `module-b sees: ${moduleA}`;
<|fim_middle|>port { moduleA } from "./module-a.js";
// module-b imports module-a; under the chained dependOn webpack should
// resolve this import through the shared runtime rather than duplicating
// module-a into both chunks.
globalThis.__moduleB =<|endoft... | fim | webpack/webpack | javascript |
"use strict";
// Tests use `import.meta.url` to locate emitted chunks at runtime and
// `globalThis` in fixtures, both of which require Node 12+.
module.exports = function filter() {
const major = Number(process.versions.node.split(".")[0]);
return major >= 12;
};
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>ript: {
importMeta: false
}
}
},
output: {
chunkFilename: "[name].chunk.js"
},
optimization: {
chunkIds: "named"
},
experiments: {
html: true,
outputModule: true
}
};
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exp<|fim_middle|>orts = {
... | fim | webpack/webpack | javascript |
<|fim_prefix|>import<|fim_suffix|>le.css";
<|fim_middle|> "./sty<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>
};
<|fim_prefix|>"use strict";
module.exports = {
findBundle() {
return ["./test.js"];
<|fim_middle|> }<|endoftext|> | fim | webpack/webpack | javascript |
const fs = require("fs");
const path = require("path");
const readFile = (name) =>
fs.readFileSync(path.resolve(__dirname, name), "utf-8");
it("should copy quoted, bare and unquoted CSP/fetch attributes byte-exact onto the synthesized sibling <link>", () => {
const extracted = readFile("page.html");
const linkMat... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
// A `<script src>` HTML entry whose JS imports CSS, carrying the three
// copyable CSP/fetch attributes in all three source forms β quoted
// (`nonce="β¦"`), bare (`crossorigin`), and unquoted (`referrerpolicy=β¦`).
// The synthesized sibling `<link>` must carry each one back byte-exact,
// ... | fim | webpack/webpack | javascript |
<|fim_prefix|>import page from "./page.html";
it("sho<|fim_suffix|>ge).toMatchSnapshot();
});
<|fim_middle|>uld silently skip whitespace-only source attribute values", () => {
expect(pa<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|> html: true
}
};
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
devtool: false,
target: "<|fim_middle|>web",
experiments: {
<|endoftext|> | fim | webpack/webpack | javascript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.