-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
110 lines (109 loc) · 3.27 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
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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const autoprefixer = require('autoprefixer');
const postcssVars = require('postcss-simple-vars');
const postcssImport = require('postcss-import');
module.exports = (env) => ({
devServer: {
open: true,
host: '0.0.0.0',
port: 8012,
contentBase: path.join(__dirname, 'build')
},
devtool: 'source-map',
mode: 'development',
output: {
path: path.join(__dirname, 'build'),
filename: '[name].js'
},
entry: {
ide: './src/index',
app: './src/playground/app'
},
resolve: {
extensions: ['.jsx', '.js', '.tsx', '.ts']
},
module: {
rules: [
{
test: /(\.js|\.jsx)$/,
use: {
loader: 'babel-loader'
},
exclude: [/node_modules/, /\/brython\//]
},
{
test: /\.ts(x?)$/,
use: ['babel-loader', 'ts-loader'],
exclude: [/node_modules/]
},
{
test: /\.css$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
modules: {
localIdentName: '[name]_[local]'
},
importLoaders: 1,
localsConvention: 'camelCase'
}
},
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: [
postcssImport,
postcssVars,
autoprefixer({
overrideBrowserslist: [
'last 3 versions',
'Safari >= 8',
'iOS >= 8'
]
})
]
}
}
]
},
{
test: /\.svg|png|jpe?g$/,
use: [
{
loader: 'url-loader',
options: {
limit: 1024 * 10,
fallback: 'file-loader'
}
}
],
exclude: [/node_modules/]
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Ace Editor',
template: 'src/playground/index.html',
filename: 'index.html',
chunks: ['app']
}),
new CopyWebpackPlugin([
{
from: 'src/libs/brython',
to: 'brython'
},
{
from: 'node_modules/skulpt/dist',
to: 'skulpt'
}
])
]
});