enso/app/ide-desktop/lib/client/webpack.config.mjs
Michał Wawrzyniec Urbańczyk 14a01c4635
New IDE build script (#3466)
2022-05-23 04:16:04 +02:00

48 lines
1.5 KiB
JavaScript

import path, { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { createRequire } from 'node:module'
import webpack from 'webpack'
import CopyPlugin from 'copy-webpack-plugin'
import { require_env } from '../../utils.mjs'
const thisPath = path.resolve(dirname(fileURLToPath(import.meta.url)))
const dist = path.resolve(require_env('ENSO_BUILD_IDE'), 'client')
const project_manager_in_bundle_path = require_env('ENSO_BUILD_PROJECT_MANAGER_IN_BUNDLE_PATH')
const bundled_engine_version = process.env['ENSO_BUILD_IDE_BUNDLED_ENGINE_VERSION']
export default {
entry: {
index: path.resolve(thisPath, 'src', 'index.js'),
},
mode: 'production',
target: 'electron-main',
output: {
path: dist,
filename: '[name].js',
},
plugins: [
new CopyPlugin({
patterns: [
{
from: path.resolve(thisPath, 'package.json'),
to: path.join(dist, 'package.json'),
},
{
from: path.resolve(thisPath, 'src', 'preload.js'),
to: path.join(dist, 'preload.js'),
},
],
options: {},
}),
new webpack.DefinePlugin({
BUNDLED_ENGINE_VERSION: JSON.stringify(bundled_engine_version),
PROJECT_MANAGER_IN_BUNDLE_PATH: JSON.stringify(project_manager_in_bundle_path),
}),
],
performance: {
hints: false,
},
stats: 'minimal',
}