does not supported webpack `context` options
wellrus opened this issue · comments
When specifying an option. The config file name is resolved without considering the option context
https://webpack.js.org/configuration/entry-context/#context
const path = require('path')
class TsconfigPathsWebpackContextPlugin {
constructor(rawOptions = {}) {
this.options = rawOptions
}
apply(compiler) {
compiler.hooks.afterPlugins.tap('TsconfigPathsWebpackContextPlugin', (compiler) => {
const tsconfigPathsPlugin = new TsconfigPathsPlugin({
...this.options,
configFile: this.options.configFile || path.resolve(compiler.options.context, './tsconfig.json')
})
compiler.options.resolve.plugins = (compiler.options.resolve.plugins || []).concat(tsconfigPathsPlugin)
})
}
}
module.exports = TsconfigPathsWebpackContextPlugin