forked from grafana/grafana-infinity-datasource
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
50 lines (48 loc) · 1.56 KB
/
Copy pathwebpack.config.ts
File metadata and controls
50 lines (48 loc) · 1.56 KB
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
import webpack, { Configuration } from 'webpack';
import { mergeWithRules } from 'webpack-merge';
import path from 'path';
import grafanaConfig from './.config/webpack/webpack.config';
const config = async (env: any): Promise<Configuration> => {
const baseConfig = await grafanaConfig(env);
const customConfig = {
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
module: {
rules: [
{
exclude: /(node_modules|libs)/,
},
],
},
resolve: {
alias: {
'@/components': path.resolve(process.cwd(), 'src/components/'),
'@/editors': path.resolve(process.cwd(), 'src/editors/'),
'@/utils': path.resolve(process.cwd(), 'src/utils/'),
'@/app': path.resolve(process.cwd(), 'src/app/'),
'@/types': path.resolve(process.cwd(), 'src/types/'),
'@/constants': path.resolve(process.cwd(), 'src/constants.ts'),
'@/datasource': path.resolve(process.cwd(), 'src/datasource.ts'),
'@/interpolate': path.resolve(process.cwd(), 'src/interpolate.ts'),
'@/migrate': path.resolve(process.cwd(), 'src/migrate.ts'),
'@/selectors': path.resolve(process.cwd(), 'src/selectors.ts'),
},
fallback: {
buffer: require.resolve('buffer/'),
stream: require.resolve('stream-browserify'),
timers: require.resolve('timers-browserify'),
},
},
};
return mergeWithRules({
module: {
rules: {
exclude: 'replace',
},
},
})(baseConfig, customConfig);
};
export default config;