forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.datascience-ui.config.js
199 lines (192 loc) · 7.65 KB
/
webpack.datascience-ui.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FixDefaultImportPlugin = require('webpack-fix-default-import-plugin');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin')
const configFileName = 'tsconfig.datascience-ui.json';
module.exports = [
{
entry: ['babel-polyfill', './src/datascience-ui/history-react/index.tsx'],
output: {
path: path.join(__dirname, 'out'),
filename: 'datascience-ui/history-react/index_bundle.js',
publicPath: './'
},
mode: 'development', // Leave as is, we'll need to see stack traces when there are errors.
// Use 'eval' for release and `eval-source-map` for development.
// We need to use one where source is embedded, due to webviews (they restrict resources to specific schemes,
// this seems to prevent chrome from downloading the source maps)
devtool: 'eval-source-map',
optimization: {
minimizer: [new TerserPlugin()]
},
node: {
fs: 'empty'
},
plugins: [
new HtmlWebpackPlugin({ template: 'src/datascience-ui/history-react/index.html', imageBaseUrl: `${__dirname.replace(/\\/g, '/')}/out/datascience-ui/history-react`, indexUrl: `${__dirname}/out/1`, filename: './datascience-ui/history-react/index.html' }),
new FixDefaultImportPlugin(),
new CopyWebpackPlugin([
{ from: './**/*.png', to: '.' },
{ from: './**/*.svg', to: '.' },
{ from: './**/*.css', to: '.' },
{ from: './**/*theme*.json', to: '.' }
], { context: 'src' }),
new MonacoWebpackPlugin({
languages: [] // force to empty so onigasm will be used
})
],
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json", ".svg"]
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{
test: /\.tsx?$/,
use: {
loader: "awesome-typescript-loader",
options: {
configFileName,
reportFiles: [
'src/datascience-ui/**/*.{ts,tsx}'
]
},
}
},
{
test: /\.svg$/,
use: [
'svg-inline-loader'
]
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
],
},
{
test: /\.js$/,
include: /node_modules.*remark.*default.*js/,
use: [
{
loader: path.resolve('./build/webpack/loaders/remarkLoader.js'),
options: {}
}
]
},
{
test: /\.json$/,
type: 'javascript/auto',
include: /node_modules.*remark.*/,
use: [
{
loader: path.resolve('./build/webpack/loaders/jsonloader.js'),
options: {}
}
]
},
{ test: /\.(png|woff|woff2|eot|ttf)$/, loader: 'url-loader?limit=100000' },
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
'less-loader'
]
}
]
}
},
{
entry: ['babel-polyfill', './src/datascience-ui/data-explorer/index.tsx'],
output: {
path: path.join(__dirname, 'out'),
filename: 'datascience-ui/data-explorer/index_bundle.js',
publicPath: './'
},
mode: 'development', // Leave as is, we'll need to see stack traces when there are errors.
// Use 'eval' for release and `eval-source-map` for development.
// We need to use one where source is embedded, due to webviews (they restrict resources to specific schemes,
// this seems to prevent chrome from downloading the source maps)
devtool: 'eval-source-map',
node: {
fs: 'empty'
},
plugins: [
new HtmlWebpackPlugin({ template: 'src/datascience-ui/data-explorer/index.html', imageBaseUrl: `${__dirname.replace(/\\/g, '/')}/out/datascience-ui/data-explorer`, indexUrl: `${__dirname}/out/1`, filename: './datascience-ui/data-explorer/index.html' }),
new FixDefaultImportPlugin(),
new CopyWebpackPlugin([
{ from: './**/*.png', to: '.' },
{ from: './**/*.svg', to: '.' },
{ from: './**/*.css', to: '.' },
{ from: './**/*theme*.json', to: '.' }
], { context: 'src' }),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
})
],
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json", ".svg"]
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{
test: /\.tsx?$/,
use: {
loader: "awesome-typescript-loader",
options: {
configFileName,
reportFiles: [
'src/datascience-ui/**/*.{ts,tsx}'
]
},
}
},
{
test: /\.svg$/,
use: [
'svg-inline-loader'
]
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
],
},
{
test: /\.js$/,
include: /node_modules.*remark.*default.*js/,
use: [
{
loader: path.resolve('./build/webpack/loaders/remarkLoader.js'),
options: {}
}
]
},
{
test: /\.json$/,
type: 'javascript/auto',
include: /node_modules.*remark.*/,
use: [
{
loader: path.resolve('./build/webpack/loaders/jsonloader.js'),
options: {}
}
]
}
]
}
}
];