forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.datascience-ui.config.js
84 lines (80 loc) · 3.07 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
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 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',
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' }),
],
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json"]
},
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: /\.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: {}
}
]
}
]
}
};