forked from x-orpheus/react-monaco-editor-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.build.demo.js
69 lines (68 loc) · 1.7 KB
/
webpack.build.demo.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
// @ts-nocheck
/* eslint-disable */
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const Alias = require('alias-jsconfig-webpack-plugin');
module.exports = {
entry: {
app: './demo/index.ts',
},
output: {
globalObject: 'self',
path: path.join(__dirname, 'build'),
filename: '[name].bundle.js',
},
mode: 'production',
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: ['ts-loader'],
},
{
test: /\.(css|less)$/,
use: ['style-loader', 'css-loader', 'less-loader'],
},
{
test: /\.(jpg|jpeg|png|gif|mp3|svg|ttf)$/,
use: ['file-loader'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'demo', 'index.html'),
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
new webpack.DefinePlugin({
_ASSETSPATH: JSON.stringify(
'https://s5.music.126.net/static_public/6194df158463e8444a55b9d8_6194df158463e8444a55b9da/'
),
}),
new Alias({
language: 'ts', // or 'ts'
jsx: true, // default to true,
indentation: 4, // default to 4, the indentation of jsconfig.json file
}),
],
resolve: {
modules: ['demo', 'src', 'node_modules'],
extensions: ['.tsx', '.ts', '.jsx', '.js'],
alias: {
'@components': path.resolve(__dirname, './src/components'),
'@utils': path.resolve(__dirname, './src/utils'),
},
},
};