-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.babel.js
More file actions
98 lines (96 loc) · 2.26 KB
/
webpack.config.babel.js
File metadata and controls
98 lines (96 loc) · 2.26 KB
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
import path from 'path'
import webpack from 'webpack'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import sveltePreprocess from 'svelte-preprocess'
const mode = process.env.NODE_ENV || 'development'
const production = mode === 'production'
export default {
mode,
watch: !production,
devtool: 'source-map',
entry: { 'mpilot-ui': path.resolve('./src/index') },
module: {
rules: [
{
test: /\.ts$/,
include: path.resolve('./src/**/*'),
loader: 'ts-loader',
},
{
test: /\.svelte$/,
exclude: { and: [/node_modules/], not: [/svelte/] },
use: [
{
loader: 'babel-loader',
options: {
presets: [['@babel/env', { targets: { ie: '11' } }]],
},
},
{
loader: 'svelte-loader',
options: {
preprocess: sveltePreprocess(),
compilerOptions: {
dev: !production,
},
emitCss: true,
},
},
],
},
{
test: /\.m?js$/,
exclude: { and: [/node_modules/], not: [/svelte/] },
resolve: {
fullySpecified: false,
},
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/env', { targets: { ie: '11' } }]],
},
},
},
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: '../../',
},
},
{
loader: 'css-loader',
},
],
},
{
test: /\.ts$/,
exclude: [/node_modules\/.*\/dist\/.*/],
use: 'ts-loader',
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].bundle.css',
}),
new webpack.ProvidePlugin({ _entities: 'parse-entities' }),
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js',
libraryTarget: 'umd',
library: 'mpilotUI',
umdNamedDefine: true,
},
resolve: {
modules: ['node_modules', './src'],
extensions: ['.ts', '.js'],
fallback: {
path: require.resolve('path-browserify'),
fs: false,
},
},
}