Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not supported webpack context options #80

Open
wellrus opened this issue Jun 23, 2021 · 1 comment
Open

does not supported webpack context options #80

wellrus opened this issue Jun 23, 2021 · 1 comment

Comments

@wellrus
Copy link

wellrus commented Jun 23, 2021

When specifying an option. The config file name is resolved without considering the option context
https://webpack.js.org/configuration/entry-context/#context

@gityoog
Copy link

gityoog commented Jul 9, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants