MCPcopy
hub / github.com/webpack/sass-loader / getCompiler

Function getCompiler

test/helpers/getCompiler.js:54–88  ·  view source on GitHub ↗
(fixture, config = {}, options = {})

Source from the content-addressed store, hash-verified

52 * @returns {Configuration} build configuration
53 */
54export default function getCompiler(fixture, config = {}, options = {}) {
55 // webpack Config
56 config = {
57 cache: config.cache || false,
58 mode: config.mode || "development",
59 devtool: config.devtool || false,
60 // context: path.resolve(__dirname, '..', 'fixtures'),
61 context: path.resolve(__dirname, ".."),
62 entry: config.entry || `./${fixture}`,
63 output: output(config),
64 module: module(config),
65 plugins: plugins(config),
66 optimization: {
67 runtimeChunk: false,
68 minimizer: [],
69 },
70
71 resolve: config.resolve || undefined,
72 };
73
74 // Compiler Options
75 options = { output: false, ...options };
76
77 if (options.output) {
78 deleteSync(config.output.path);
79 }
80
81 const compiler = webpack(config);
82
83 if (!options.output) {
84 compiler.outputFileSystem = createFsFromVolume(new Volume());
85 }
86
87 return compiler;
88}

Calls 3

outputFunction · 0.85
moduleFunction · 0.85
pluginsFunction · 0.85

Tested by 1

createTestCaseFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…