2022-08-10 16:38:23 -07:00
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
|
|
const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin')
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
2022-09-22 15:29:29 -04:00
|
|
|
const { DefinePlugin } = require('webpack')
|
|
|
|
|
|
|
|
const commitHash = require('child_process').execSync('git rev-parse HEAD')
|
2022-08-10 16:38:23 -07:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
babel: {
|
|
|
|
plugins: ['@vanilla-extract/babel-plugin'],
|
2023-01-09 15:54:48 -06:00
|
|
|
},
|
|
|
|
jest: {
|
|
|
|
configure(jestConfig) {
|
|
|
|
return Object.assign({}, jestConfig, {
|
2023-01-25 17:12:23 -05:00
|
|
|
transformIgnorePatterns: ['@uniswap/conedison/format', '@uniswap/conedison/provider'],
|
2023-01-09 15:54:48 -06:00
|
|
|
moduleNameMapper: {
|
|
|
|
'@uniswap/conedison/format': '@uniswap/conedison/dist/format',
|
2023-01-25 17:12:23 -05:00
|
|
|
'@uniswap/conedison/provider': '@uniswap/conedison/dist/provider',
|
2023-01-09 15:54:48 -06:00
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
2022-08-10 16:38:23 -07:00
|
|
|
},
|
|
|
|
webpack: {
|
2022-09-22 15:29:29 -04:00
|
|
|
plugins: [
|
|
|
|
new VanillaExtractPlugin(),
|
|
|
|
new DefinePlugin({
|
|
|
|
'process.env.REACT_APP_GIT_COMMIT_HASH': JSON.stringify(commitHash.toString()),
|
|
|
|
}),
|
|
|
|
],
|
2022-08-10 16:38:23 -07:00
|
|
|
configure: (webpackConfig) => {
|
|
|
|
const instanceOfMiniCssExtractPlugin = webpackConfig.plugins.find(
|
|
|
|
(plugin) => plugin instanceof MiniCssExtractPlugin
|
|
|
|
)
|
|
|
|
if (instanceOfMiniCssExtractPlugin !== undefined) instanceOfMiniCssExtractPlugin.options.ignoreOrder = true
|
2022-11-17 19:59:40 +01:00
|
|
|
|
|
|
|
// We're currently on Webpack 4.x that doesn't support the `exports` field in package.json.
|
|
|
|
// See https://github.com/webpack/webpack/issues/9509.
|
|
|
|
//
|
|
|
|
// In case you need to add more modules, make sure to remap them to the correct path.
|
|
|
|
//
|
|
|
|
// Map @uniswap/conedison to its dist folder.
|
|
|
|
// This is required because conedison uses * to redirect all imports to its dist.
|
|
|
|
webpackConfig.resolve.alias['@uniswap/conedison'] = '@uniswap/conedison/dist'
|
|
|
|
|
2022-08-10 16:38:23 -07:00
|
|
|
return webpackConfig
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|