Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const outputFilename = path.join(
path.isAbsolute(cacheDirectory)
? cacheDirectory
: path.join(process.cwd(), cacheDirectory),
path.relative(
process.cwd(),
this.resourcePath.replace(/\.[^.]+$/, '.linaria.css')
)
);
const resolveOptions = {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
};
const resolveSync = enhancedResolve.create.sync(
// this._compilation is a deprecated API
// However there seems to be no other way to access webpack's resolver
// There is this.resolve, but it's asynchronous
// Another option is to read the webpack.config.js, but it won't work for programmatic usage
// This API is used by many loaders/plugins, so hope we're safe for a while
this._compilation && this._compilation.options.resolve
? {
...resolveOptions,
alias: this._compilation.options.resolve.alias,
modules: this._compilation.options.resolve.modules,
}
: resolveOptions
);
let result;
export function makeResolver(options: webpack.Configuration): ResolveSync {
return node.create.sync(options.resolve);
}
function makeSyncResolver (options) {
return resolve.create.sync(options.resolve)
}