forked from VolkovLabs/business-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
50 lines (46 loc) · 1.47 KB
/
webpack.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// webpack.config.ts
import type { Configuration } from 'webpack';
import { merge } from 'webpack-merge';
import grafanaConfig from './.config/webpack/webpack.config';
import path from 'path'; // Add this import
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
/**
* Config
*/
const config = async (env): Promise<Configuration> => {
const baseConfig = await grafanaConfig(env);
return merge(baseConfig, {
output: {
asyncChunks: true,
// Ensure source map paths reference @volkovlabs correctly
devtoolModuleFilenameTemplate: (info) =>
info.resourcePath.startsWith('.') ?
`webpack:///${info.resourcePath}` :
`webpack://@volkovlabs/${path.relative(path.resolve(__dirname, 'node_modules'), info.resourcePath)}`,
},
// devtool: env.production ? 'source-map' : 'eval-source-map', // Force source maps
devtool: 'eval-source-map',
module: {
rules: [
{
test: /\.(js|ts)x?$/,
include: [
// Explicitly include volkovlabs components source maps
path.resolve(__dirname, 'node_modules/@volkovlabs/components'),
],
use: ['source-map-loader'],
enforce: 'pre',
},
],
},
resolve: {
plugins: [
new TsconfigPathsPlugin({
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
configFile: path.resolve(__dirname, 'tsconfig.json'),
})
],
},
});
};
export default config;