()
| 95 | let isInitialBuild = context.compiler === null |
| 96 | |
| 97 | async function createCompiler() { |
| 98 | DEBUG && I.start('Setup compiler') |
| 99 | if (context.fullRebuildPaths.length > 0 && !isInitialBuild) { |
| 100 | clearRequireCache(context.fullRebuildPaths) |
| 101 | } |
| 102 | |
| 103 | context.fullRebuildPaths = [] |
| 104 | |
| 105 | DEBUG && I.start('Create compiler') |
| 106 | let compiler = await compile(source, { |
| 107 | from: inputFile, |
| 108 | base: inputBasePath, |
| 109 | shouldRewriteUrls: true, |
| 110 | onDependency: (depPath) => context.fullRebuildPaths.push(depPath), |
| 111 | // In CSS Module files, we have to disable the `@property` polyfill since these will |
| 112 | // emit global `*` rules which are considered to be non-pure and will cause builds |
| 113 | // to fail. |
| 114 | polyfills: isCSSModuleFile ? Polyfills.All ^ Polyfills.AtProperty : Polyfills.All, |
| 115 | }) |
| 116 | DEBUG && I.end('Create compiler') |
| 117 | |
| 118 | DEBUG && I.end('Setup compiler') |
| 119 | return compiler |
| 120 | } |
| 121 | |
| 122 | // Setup the compiler if it doesn't exist yet |
| 123 | context.compiler ??= await createCompiler() |
no test coverage detected