text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|><|fim_suffix|>port default "main/a";
<|fim_middle|>ex<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>ide/a";
<|fim_prefix|>export default "ov<|fim_middle|>err<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const path = require("path");
const webpack = <|fim_suffix|>eplacementPlugin(/main/, (context) => {
Object.assign(context, {
resource: ["../override"] // resolved relatively
});
})
]
};
<|fim_middle|>require("../../../../");
/** @type {import("../../../../").Configuration} */
... | fim | webpack/webpack | javascript |
<|fim_prefix|>const load = id => import<|fim_suffix|>ide/a");
});
<|fim_middle|>(`app/${id}?query#hash`);
it("show override request", async () => {
expect((await load("a")).default).toBe("overr<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>default "foo/a";
<|fim_prefix|>expor<|fim_middle|>t <|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>efault "main/a";
<|fim_prefix|>exp<|fim_middle|>ort d<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>a";
<|fim_prefix|>export default "override<|fim_middle|>/<|endoftext|> | fim | webpack/webpack | javascript |
"use strict";
const path = require("path");
const webpack = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
resolve: {
alias: {
app: [path.join(__dirname, "src/main"), path.join(__dirname, "src/foo")]
}
},
plugins: [new webpack.ContextReplacementPlugin(/main/,... | fim | webpack/webpack | javascript |
<|fim_prefix|>it("should replace a async context with a<|fim_suffix|>
var a = "a";
return import(a).then(function(a) {
expect(a).toEqual(nsObj({ default: "b" }));
});
});
<|fim_middle|> manual map", function() {<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>module.<|fim_suffix|>;
<|fim_middle|>exports = "b"<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>placementPlugin(
/replacement/,
path.resolve(__dirname, "modules"),
{
a: "./module-b"
}
)
]
};
<|fim_prefix|>"use strict";
var path = require("path");
var webpack<|fim_middle|> = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: ... | fim | webpack/webpack | javascript |
it("should replace a context with a new resource and reqExp", function(done) {
function rqInContext(x, callback) {
require([x], function(x) {
callback(x);
});
}
rqInContext("replaced", function(r) {
expect(r).toBe("ok");
done();
});
});
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|> new webpack.ContextReplacementPlugin(
/replacement.a$/,
"new-context",
true,
/^replaced$/
)
]
};
<|fim_prefix|>"use strict";
const webpack = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [<|fim_middle|>
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>
an
error
}])<|fim_prefix|>This
<|fim_middle|>should
result
in<|endoftext|> | fim | webpack/webpack | javascript |
it("should replace a context with a new regExp", function() {
function rqInContext(x) {
return require(x);
}
expect(rqInContext("./only-this")).toBe("ok");
});
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>module.exports<|fim_suffix|>ok";<|fim_middle|> = "<|endoftext|> | fim | webpack/webpack | javascript |
"use strict";
const webpack = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [new webpack.ContextReplacementPlugin(/replacement.b$/, /^\.\/only/)]
};
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>it("should replace a context with a manual map", function() {
function rqInContext(x) {
return require(x);
}
expect(rqInContext("a")).toBe("a<|fim_suffix|>});
<|fim_middle|>");
expect(rqInContext("b")).toBe("b");
expect(rqInContext("./c")).toBe("b");
expect(rqInContext("d")).toBe("d");
expect(rqI... | fim | webpack/webpack | javascript |
module.exports = "a";
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>b";
<|fim_prefix|>module.e<|fim_middle|>xports = "<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|> "modules"),
{
a: "./a",
b: "./module-b",
"./c": "./module-b",
d: "d",
"./d": "d"
}
)
]
};
<|fim_prefix|>"use strict";
const path = require("path");
const webpa<|fim_middle|>ck = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
... | fim | webpack/webpack | javascript |
<|fim_prefix|>it("should replace <|fim_suffix|>
});
<|fim_middle|>a context with resource query and manual map", function() {
function rqInContext(x) {
return require(x);
}
expect(rqInContext("a")).toEqual({
resourceQuery: "?cats=meow",
query: "?lions=roar",
prev: "module.exports = \"a\";\n",
});<|endoftext... | fim | webpack/webpack | javascript |
<|fim_prefix|>module.ex<|fim_suffix|>s = "a";
<|fim_middle|>port<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>/** @type {import("../../../../").LoaderDefinition} */
module.exports = function (content) {
return (
"module.export<|fim_suffix|>his.resourceQuery,
query: this.query,
prev: content.replace(/\r\n?/g, "\n")
})
);
};
<|fim_middle|>s = " +
JSON.stringify({
resourceQuery: t<|endoftext|> | fim | webpack/webpack | javascript |
"use strict";
const path = require("path");
const webpack = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
module: {
rules: [
{
test: /a\.js$/,
use: ["./queryloader?lions=roar"]
}
]
},
plugins: [
new webpack.ContextReplacementPlugin(
/replacem... | fim | webpack/webpack | javascript |
<|fim_suffix|>e([x], function (x) {
callback(x);
});
}
rqInContext("replaced", function (r) {
expect(r).toBe("ok");
rqInContext("./modules/replaced", function (r) {
expect(r).toBe("ok");
done();
});
});
});
<|fim_prefix|>it("should replace a context with a new resource and reqExp", function (done) {... | fim | webpack/webpack | javascript |
<|fim_prefix|>This<|fim_suffix|>d
result
in
an
error
}])<|fim_middle|>
shoul<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>modul<|fim_suffix|>rts = "ok";<|fim_middle|>e.expo<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>};
<|fim_prefix|>"use strict";
const path = require("path");
const webpack = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
resolve: {
modules: ["...", path.resolve(__dirname, "new-context/modules")]
},
plugins: [
new webpack.ContextReplacementPlug... | fim | webpack/webpack | javascript |
<|fim_suffix|>ts = "a";
<|fim_prefix|>modu<|fim_middle|>le.expor<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>or
}])<|fim_prefix|>This
shou<|fim_middle|>ld
result
in
an
err<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>ect(rqInContext("a")).toBe("a");
});
<|fim_prefix|>it("should replace a context with a new regExp", function() {
funct<|fim_middle|>ion rqInContext(x) {
return require('./folder/' + x);
}
exp<|endoftext|> | fim | webpack/webpack | javascript |
"use strict";
const webpack = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [new webpack.ContextReplacementPlugin(/folder$/, false, /(a|b)/)]
};
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>it("should load script without crossorigin attribute (default)", function() {
const promise = import("./empty?a" /* webpackChunkName: "crossorigin-default" */);
var script = document.head._children.pop();
__non_webpack_require__("./crossorigin-default.web.js");
expect(script.src).toBe("https://test.c... | fim | webpack/webpack | javascript |
<|fim_suffix|>js",
crossOriginLoading: "anonymous"
},
performance: {
hints: false
},
optimization: {
minimize: false
},
experiments: {
css: true
}
};
<|fim_prefix|>"use strict";
/** @type {im<|fim_middle|>port("../../../../").Configuration} */
module.exports = {
target: "web",
output: {
chunkFilenam... | fim | webpack/webpack | javascript |
<|fim_suffix|>to dynamic import a pure css", done => {
import("./style.css").then(x => {
expect(Object.keys(x).length).toBe(0)
done();
}, done);
});
<|fim_prefix|>it("should allow to dynamic import a css module", done => {
import("../pseudo-export<|fim_middle|>/style.module.css").then(x => {
try {
expect(x)... | fim | webpack/webpack | javascript |
<|fim_suffix|>nts: {
css: true
}
};
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration}<|fim_middle|> */
module.exports = {
target: "node",
mode: "development",
experime<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>("padding")).toBe(" 20px 10px");
done();
}, done);
});
<|fim_prefix|>import * as style from "./style.css";
it("should compile and load style on demand", done => {
expect(style).toEqual({});
import("./style2.css").then(x => {
expect(x).toEqual({});
const style = getComputedStyle(document.body);
... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
module.exports = {
findBundle() {
return ["style2_css.bundle0.js", "bundle0.js"];
},
moduleScope(scope) {
const link = scope.window.document.createElement("link");
link.rel = "stylesheet";
link.href = "bundle0.css";
scope.window.document.head<|fim_suffix|>ld(link);
}
};
<|fim_... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "w<|fim_suffix|>
css: true
}
};
<|fim_middle|>eb",
mode: "development",
experiments: {<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>it("should compile and load style on demand", (done) => {
import("./style.css").then(x => {
expect(x).toEqual({});
const style = getComputedStyle(document.body);
e<|fim_suffix|>
}, done);
});
<|fim_middle|>xpect(style.getPropertyValue("background")).toBe(" red");
expect(style.getPropertyValue("m... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
module.exports = {
findBundle() {
retur<|fim_suffix|>"bundle0.js"];
}
};
<|fim_middle|>n ["style_css.bundle0.js", <|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use stri<|fim_suffix|>e: "development",
externalsPresets: { web: false, webAsync: true },
experiments: {
css: true
}
};
<|fim_middle|>ct";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
mod<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import *<|fim_suffix|>hould compile and load style on demand", done => {
expect(style).toEqual({});
import("./style2.css").then(x => {
expect(x).toEqual({});
done();
}, done);
});
<|fim_middle|> as style from "./style.css";
it("s<|endoftext|> | fim | webpack/webpack | javascript |
"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "node",
mode: "development",
experiments: {
outputModule: true,
css: true
},
output: {
module: true,
chunkFormat: "module"
}
};
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|> done();
}, done);
});
<|fim_prefix|>import * as style from "./style.css";
it("should compile and load style on demand", done => {
expect(style).toEqual({});
import("./style2.css").then(x => {
expect(x).toEqual({});
const <|fim_middle|>style = getComputedStyle(document.body);
expect(style.getPro... | fim | webpack/webpack | javascript |
<|fim_suffix|>appendChild(link);
}
};
<|fim_prefix|>"use st<|fim_middle|>rict";
module.exports = {
moduleScope(scope) {
const link = scope.window.document.createElement("link");
link.rel = "stylesheet";
link.href = "bundle0.css";
scope.window.document.head.<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>ue
},
output: {
module: true,
chunkFormat: "module"
}
};
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
mo<|fim_middle|>de: "development",
experiments: {
outputModule: true,
css: tr<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import * as style from "./style.css";
it("should compi<|fim_suffix|>computedStyle.getPropertyValue("background")).toBe(" red");
expect(computedStyle.getPropertyValue("margin")).toBe(" 10px");
});
<|fim_middle|>le and load initial style", () => {
expect(style).toEqual({});
const computedStyle = getComp... | fim | webpack/webpack | javascript |
<|fim_suffix|>ument.head.appendChild(link);
}
};
<|fim_prefix|>"use strict";
module.exports = {
moduleScope(scope) {
const link = scope.window.document<|fim_middle|>.createElement("link");
link.rel = "stylesheet";
link.href = "bundle0.css";
scope.window.doc<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>port("../../../../").Configuration} */
module.exports = {
target: "web",
mode: "development",
externalsPresets: { web: false, webAsync: true },
experiments: {
css: true
}
};
<|fim_prefix|>"use strict";
/<|fim_middle|>** @type {im<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import * as style from "./style.css";
it("should compile and load style on demand", do<|fim_suffix|>ody);
expect(style.getPropertyValue("background")).toBe(" red");
expect(style.getPropertyValue("margin")).toBe(" 10px");
expect(style.getPropertyValue("color")).toBe(" green");
expect(style.getProp... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
module.exports = {
findBundle() {
return ["style2_css.bundle<|fim_suffix|>scope) {
const link = scope.window.document.createElement("link");
link.rel = "stylesheet";
link.href = "bundle0.css";
scope.window.document.head.appendChild(link);
}
};
<|fim_middle|>0.js", "bundle0.js"];... | fim | webpack/webpack | javascript |
<|fim_suffix|>ss: true
}
};
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
mode: "development",
externalsP<|fim_middle|>resets: { web: false, webAsync: true },
experiments: {
c<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>hSnapshot();
done();
});
<|fim_prefix|>import "./sty<|fim_middle|>le.css";
it(`should work with URLs in CSS`, done => {
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);
}... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
module.exports = {
moduleScope(scope) {
const link = scope.window.document.createElement("link"<|fim_suffix|>d(link);
}
};
<|fim_middle|>);
link.rel = "stylesheet";
link.href = "bundle0.css";
scope.window.document.head.appendChil<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
cons<|fim_suffix|>* @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
mode: "development",
experiments: {
buildHttp: {
allowedUris: [() => true],
lockfileLocation: path.resolve(__dirname, "./lock-files/lock.json"),
cacheLocation: path.resolve(__... | fim | webpack/webpack | javascript |
<|fim_suffix|>.links].slice(1)) {
css1.push(link.sheet.css);
}
expect(css1).toMatchSnapshot();
expect(text).toMatchSnapshot();
expect(textImport).toMatchSnapshot();
expect(styleSheet._cssText).toMatchSnapshot();
expect(textInherited).toMatchSnapshot();
expect(textInheritedDirect).toMatchSnapshot();
// styles... | fim | webpack/webpack | javascript |
<|fim_suffix|> const link = scope.window.document.createElement("link");
link.rel = "stylesheet";
link.href = "bundle0.css";
scope.window.document.head.appendChild(link);
}
};
<|fim_prefix|>"use strict";
module.exports = {
moduleS<|fim_middle|>cope(scope) {
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
output: {
chunkFilename: "[name].chunk.js"
},
module: {
rules: [
{
test: <|fim_suffix|>.css$/,
type: "css/auto",
parser: { exportType: "link" }
},
{
test: /\.text\.css$/,
... | fim | webpack/webpack | javascript |
<|fim_prefix|>function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
it("should able to require the css module as commonjs", () => {
const style = require("./style.module.css"<|fim_suffix|>qual("style_module_css-foo");
});
<|fim_middle|>);
const interoperatedStyle = _interopR... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
module.exports = {
moduleScope(scope) {
if (scope.document) <|fim_suffix|>l = "stylesheet";
link.href = "bundle0.css";
scope.document.head.appendChild(link);
}
}
};
<|fim_middle|>{
const link = scope.document.createElement("link");
link.re<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>o": {
esModule: false
}
}
},
experiments: {
css: true
}
},
{
target: "node",
mode: "development",
module: {
generator: {
"css/auto": {
esModule: false
}
}
},
experiments: {
css: true
}
}
];
<|fim_prefix|>"use strict";
/** @type {import("../../../.... | fim | webpack/webpack | javascript |
<|fim_prefix|>import * as styles from "./style.modules.css";
<|fim_suffix|>s resolves under camel-case-only", () => {
// Only camelCased names are exported under `camel-case-only`.
expect(styles.fooBar).toBeDefined();
expect(styles.baz).toBeDefined();
expect(styles.qux).toBeDefined();
expect(styles).not.toHaveProp... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../.<|fim_suffix|>,
mode: "development",
experiments: {
css: true
},
module: {
rules: [
{
test: /\.modules\.css$/,
type: "css/module",
generator: {
exportsConvention: "camel-case-only"
}
}
]
}
};
<|fim_middle|>./").Configuration... | fim | webpack/webpack | javascript |
<|fim_suffix|>.join(STATS.outputPath, `bundle${__STATS_I__}.js`),
"utf-8"
);
// The webpack require runtime template defines a private cache
// variable; checking for that name detects whether the runtime was
// pulled in. Assembled at runtime so the literal in this file's
// source doesn't match itself once in... | fim | webpack/webpack | javascript |
<|fim_prefix|>import "./link-root.link.css";
const STATS = __STATS__.children[__STATS_I__];
it("should fold every link-export module into a single concatenated module", () => {
const concatModules = STATS.modules.filter((m) => m.modules);
expect(concatModules.length).toBe(1);<|fim_suffix|>adFileSync(
path.join(ST... | fim | webpack/webpack | javascript |
<|fim_suffix|>{
const fs = __non_webpack_require__("fs");
const path = __non_webpack_require__("path");
const source = fs.readFileSync(
path.join(STATS.outputPath, `bundle${__STATS_I__}.js`),
"utf-8"
);
// The webpack require runtime template defines a private cache
// variable; checking for that name detect... | fim | webpack/webpack | javascript |
<|fim_suffix|>st path = __non_webpack_require__("path");
const source = fs.readFileSync(
path.join(STATS.outputPath, `bundle${__STATS_I__}.js`),
"utf-8"
);
// The webpack require runtime template defines a private cache
// variable; checking for that name detects whether the runtime was
// pulled in. Assemble... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @typedef {import("../../../../").Configuration} Configuration */
/** @type {("text" | "css-style-sheet" | "style" | "link")[]} */
const exportType<|fim_suffix|>ncatenateModules: true,
minimize: false,
usedExports: true,
chunkIds: "named"
},
// Keep __dirname/__filename as-is so... | fim | webpack/webpack | javascript |
<|fim_suffix|>rt("./lazy1.css"),
import("./lazy2.css"),
import("./lazy3.css"),
import("./lazy4.js")
]).then(() => {
try {
const matches = fs
.readFileSync(path.join(__dirname, "css.bundle0.css"), "utf-8")
.match(/color: ([a-z0-9])/g)
.map(match => match[7]);
expect(matches).toEqual("bcdea123"... | fim | webpack/webpack | javascript |
<|fim_prefix|>imp<|fim_suffix|>/a.css";
<|fim_middle|>ort "./e.css";
import ".<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>e0.js"];
}
};
<|fim_prefix|>"use strict";
module.exports = {
findBundle() {
return ["css.bundle0.j<|fim_middle|>s", "lazy4_js.bundle0.js", "bundl<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
mode: "development",
experim<|fim_suffix|>true
},
node: {
__dirname: false
}
};
<|fim_middle|>ents: {
css: true
},
optimization: {
splitChunks: {
cacheGroups: {
css: {
type: "css/... | fim | webpack/webpack | javascript |
export const name = 'async';
<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|> expect(style).toEqual({});
const computedStyle = getComputedStyle(document.body);
expect(computedStyle.getPropertyValue("background")).toBe(" green");
expect(computedStyle.getPropertyValue("color")).toBe(" yellow");
import("./async.css").then(x => {
expect(x).toEqual({});
const style = getCom... | fim | webpack/webpack | javascript |
"use strict";
const findOutputFiles = require("../../../helpers/findOutputFiles");
module.exports = {
findBundle(i, options) {
const async1 = findOutputFiles(options, /^async.async_js.+.js/)[0];
const async2 = findOutputFiles(options, /^async.async_css.+.js/)[0];
const bundle = findOutputFiles(options, /^bundl... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../<|fim_suffix|> filename: "bundle.[name].[contenthash].js",
cssFilename: "bundle.[name].[contenthash].css",
chunkFilename: "async.[name].[contenthash].js",
cssChunkFilename: "async.[name].[contenthash].css"
},
experiments: {
css: true
}
};
<|fim_middle|>../.... | fim | webpack/webpack | javascript |
it("should apply mini-css-extract-plugin-style attributes/linkType via createStylesheet hook", async () => {
await import("./style.css");
const links = [...document.getElementsByTagName("link")];
const styleLink = links.find((link) => /style_css/.test(link.href));
expect(styleLink).toBeDefined();
expect(styleLin... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict<|fim_suffix|>odule.exports = {
findBundle() {
return ["style_css.chunk.js", "bundle0.js"];
}
};
<|fim_middle|>";
m<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const webpack = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
target: "web",
output: {
chunkFilename: "[name].chunk.js"
},
optimization: {
chunkIds: "named"
},
plugins: [
(compiler) => {
compiler.hooks.thisCompilation.tap(
... | fim | webpack/webpack | javascript |
<|fim_suffix|>const red = '#f00';
export const green = '#0f0';<|fim_prefix|>export<|fim_middle|> <|endoftext|> | fim | webpack/webpack | javascript |
import "./global.less";
import * as style1 from "./style1.module.less";
import * as style2 from "./style2.modules.less";
import * as style3 from "./style3.module.less!=!./loader.js!./style3.module.js";
import * as style4 from "./style4.module.less!=!./loader.js!./style4.js";
import * as style5 from "./style5.module.css... | fim | webpack/webpack | javascript |
<|fim_suffix|> this.resourcePath + '.webpack[javascript/auto]' + '!=!' + remaining, {
publicPath: ''
});
return result.default || result;
};
<|fim_prefix|>/** @ty<|fim_middle|>pe {import("../../../../").PitchLoaderDefinitionFunction} */
exports.pitch = async function (remaining) {
const result = await this.impo... | fim | webpack/webpack | javascript |
<|fim_prefix|>import { green, red } from './colors.js';
export default `
.class { color: $<|fim_suffix|>und: ${red}; }
`;
<|fim_middle|>{green}; }
body { backgro<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>';
export default `
.class { color: ${green}; }
body { background: ${red}; }
`;
<|fim_prefix|>import { green, red <|fim_middle|>} from './colors.js<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>d.appendChild(link);
}
};
<|fim_prefix|>"use strict";
module.exports = {
moduleScope(<|fim_middle|>scope) {
const link = scope.window.document.createElement("link");
link.rel = "stylesheet";
link.href = "bundle0.css";
scope.window.document.hea<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
/** @type {import("../../../../types").Configuration} */
module<|fim_suffix|>s = {
target: "web",
mode: "development",
experiments: {
css: true
},
module: {
rules: [
{
test: /\.less$/,
use: "less-loader",
type: "css/auto"
}
]
}
};
<|fim_middle|>.export<|endofte... | fim | webpack/webpack | javascript |
<|fim_suffix|>ementsByTagName("link");
// Only the manually-attached <link> from test.config.js (when present) exists;
// the bundle itself does not emit a CSS chunk.
expect(links.length).toBeLessThanOrEqual(1);
});
}
if (EXPORT_TYPE === "css-style-sheet") {
it("should export a CSSStyleSheet as the `default` e... | fim | webpack/webpack | javascript |
<|fim_suffix|>ontent) {
return content.replace(/\/[*/][#]?\s*sourceMappingURL=.+(\*\/)?/g, "");
};
<|fim_prefix|>/** @type <|fim_middle|>{import("../../../../").LoaderDefinition} */
module.exports = function loader(c<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_suffix|>extname(jsFilename))}.css`;
const link = scope.window.document.createElement("link");
link.rel = "stylesheet";
link.href = cssFilename;
scope.window.document.head.appendChild(link);
}
};
<|fim_prefix|>"use strict";
const path = require("path");
module.exports = {
moduleScope(scope, options) {... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const path = require("path");
const webpack = require("../../../../");
/** @typedef {import("../../../../").PathData} PathData */
/** @typedef {import("../../../../").Configuration} Configuration */
/** @typedef {"link" | "text" | "css-style-sheet" | "style"} ExportType */
const EXPORT_TY... | fim | webpack/webpack | javascript |
<|fim_suffix|>"global dev");
}
} catch (e) {
return done(e);
}
done();
}, done);
});
<|fim_prefix|>const prod = pr<|fim_middle|>ocess.env.NODE_ENV === "production";
it("should allow to create css modules", done => {
import("./use-style-global.js").then(({ default: x }) => {
try {
expect(x).toMatchS... | fim | webpack/webpack | javascript |
<|fim_suffix|>k_require__("fs");
const path = __non_webpack_require__("path");
const cssOutputFilename = `bundle6.css`;
const cssContent = fs.readFileSync(
path.join(__dirname, cssOutputFilename),
"utf-8"
);
expect(cssContent).toMatchSnapshot("options css");
});
<|fim_prefix|>import * as styles from "./style.... | fim | webpack/webpack | javascript |
<|fim_prefix|>const prod = process.env.NODE_ENV === "production";
it("should allow to create css modules", done => {
import("./use-style.js").then(({ default: x }) => {
try {
expect(x).toMatchSnapshot(prod ? "prod" : "dev");
const fs = __non_webpack_require__("fs");
const path = __non_webpack_require__("... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const fs = require("fs");
/**
* @param {string} dir output directory
* @param {number} i config index
* @returns {string} bundle filename for the deterministic chunk
*/
const findDeterministicBundle = (dir, i) => {
const re = new RegExp(`^\\d+\\.bundle${i}\\.js$`);
const found = fs.r... | fim | webpack/webpack | javascript |
<|fim_prefix|>import * as sty<|fim_suffix|>";
export default style;
<|fim_middle|>le from "./style.module.css<|endoftext|> | fim | webpack/webpack | javascript |
<|fim_prefix|>import * as style from "./style.module.css";
import { local1, local2, local3, local4, ident } from "./style.module.css";
import { myCssClass } from "./style.module.my-css";
import * as notACssModule from "./style.module.css.invalid";
import { UsedClassName } from "./identifiers.module.css";
// To prevent... | fim | webpack/webpack | javascript |
<|fim_prefix|>"use strict";
const path = require("path");
const webpack = require("../../../../");
/** @type {NonNullable<import("../../../../").Configuration["module"]>["rules"]} */
const baseRules = [
{
test: /\.my-css$/i,
type: "css/auto"
},
{
test: /\.invalid$/i,
type: "css/auto"
}
];
/** @type {impo... | fim | webpack/webpack | javascript |
import * as styles from "./entry.modules.css";
it("orders composes-from-file imports topologically across rules", () => {
const link = document
.getElementsByTagName("link")
.find((l) => l.href.endsWith("bundle0.css"));
expect(link.sheet.css).toMatchSnapshot();
expect(styles).toMatchSnapshot();
});
<|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.