forked from leanprover/lean3-web-editor
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathwebpack.config.js
81 lines (78 loc) · 2.42 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MonacoEditorSrc = path.join(__dirname, 'node_modules', 'react-monaco-editor');
const VSMonacoEditorSrc = path.join(__dirname, 'node_modules', 'monaco-editor', 'min', 'vs');
let distDir = path.resolve(__dirname, 'dist');
module.exports = {
mode: 'production',
entry: {
jsx: './src/index.tsx',
// html: './public/index.html',
// vendor: ['react', 'react-dom']
},
output: {
path: distDir,
filename: 'index.js',
publicPath: './',
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {'react-monaco-editor': MonacoEditorSrc},
fallback: {
"path": require.resolve("path-browserify"),
"buffer": require.resolve("buffer/")
}
},
module: {
rules: [
{
test: /webworkerscript\.js$/,
use: { loader:'worker-loader' },
},
{
test: /\.tsx?$/,
use: [
// To use babel in lean-client-js-browser, add the following to this package.json
// "babel-core": "^6.26.3",
// "babel-loader": "^7.1.2",
// "babel-polyfill": "^6.26.0",
// "babel-preset-env": "^1.7.0",
// 'babel-loader?presets[]=env',
'ts-loader'
],
},
],
},
devServer: {
allowedHosts: 'all',
static: [
{
directory: distDir,
publicPath: '/'
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'public/index.html'
}),
new CopyWebpackPlugin({
patterns: [
{ from: VSMonacoEditorSrc, to: 'vs', },
{ from: 'public/index.css', to: 'index.css', },
{ from: 'public/lean_logo.svg', to: 'lean_logo.svg', },
{ from: 'public/display-goal-light.svg', to: 'display-goal-light.svg', },
{ from: 'public/display-list-light.svg', to: 'display-list-light.svg', },
]
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
externals: {
// react: 'require("react")',
// 'react-dom': 'require("react-dom")',
},
};