MCPcopy Index your code
hub / github.com/subquery/subql / getBaseConfig

Function getBaseConfig

packages/cli/src/controller/build-controller.ts:25–85  ·  view source on GitHub ↗
(
  buildEntries: Configuration['entry'],
  projectDir: string,
  outputDir: string,
  development?: boolean
)

Source from the content-addressed store, hash-verified

23 */
24
25const getBaseConfig = (
26 buildEntries: Configuration['entry'],
27 projectDir: string,
28 outputDir: string,
29 development?: boolean
30): webpack.Configuration => {
31 // Load environment variables from .env file
32 const envConfig = loadEnvConfig(projectDir);
33 const envDefinitions = getWebpackEnvDefinitions(envConfig);
34
35 return {
36 target: 'node',
37 mode: development ? 'development' : 'production',
38 context: projectDir,
39 entry: buildEntries,
40 devtool: 'inline-source-map',
41 optimization: {
42 minimize: true,
43 minimizer: [
44 new TerserPlugin({
45 terserOptions: {
46 sourceMap: true,
47 format: {
48 beautify: true,
49 },
50 },
51 }),
52 ],
53 },
54 plugins: [new webpack.DefinePlugin(envDefinitions)],
55 module: {
56 rules: [
57 {
58 test: /\.tsx?$/,
59 exclude: /node_modules/,
60 loader: require.resolve('ts-loader'),
61 options: {
62 compilerOptions: {
63 declaration: false,
64 },
65 },
66 },
67 {
68 test: /\.ya?ml$/,
69 use: 'yaml-loader',
70 },
71 ],
72 },
73
74 resolve: {
75 extensions: ['.tsx', '.ts', '.js', '.json'],
76 plugins: [],
77 },
78
79 output: {
80 path: outputDir,
81 filename: '[name].js',
82 libraryTarget: 'commonjs',

Callers 1

runBundleFunction · 0.85

Calls 2

loadEnvConfigFunction · 0.90
getWebpackEnvDefinitionsFunction · 0.90

Tested by

no test coverage detected