forked from meetalva/alva
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
59 lines (57 loc) · 1.36 KB
/
webpack.config.js
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
51
52
53
54
55
56
57
58
59
/** @ts-check */
const Path = require('path');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const yargs = require('yargs-parser');
const flags = yargs(process.argv.slice(2));
const out = flags.out ? flags.out : './packages/core/lib';
module.exports = [
{
mode: flags.production ? 'production' : 'development',
devtool: flags.production || flags.sourceMaps ? 'source-maps' : 'cheap-source-map',
entry: {
preview: require.resolve('./packages/core/src/preview/preview.ts'),
previewRenderer: require.resolve('./packages/core/src/preview-renderer/index.ts'),
renderer: require.resolve('./packages/core/src/renderer/index.tsx'),
Mobx: require.resolve('mobx')
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
compilerOptions: {
module: 'esnext'
}
}
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
plugins: [
new MonacoWebpackPlugin({
languages: ['typescript', 'json'],
output: ''
})
],
externals: {
mobx: 'Mobx',
osenv: false,
child_process: false
},
output: {
filename: '[name].js',
library: '[name]',
libraryTarget: 'window',
path: Path.join(__dirname, out, 'scripts'),
publicPath: '/scripts/'
}
}
];