This repository has been archived by the owner on Sep 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpanel.config.js
70 lines (63 loc) · 1.45 KB
/
panel.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
const path = require('path')
const { createConfig } = require('cep-bundler-webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const isDev = process.env.IS_DEV === '1'
const dest = path.join(__dirname, 'dist')
const config = createConfig({
type: 'cep',
id: 'cep.svelte.webpack',
entry: './src/app/main.js',
out: dest,
isDev: isDev,
devPort: 8080,
})
config.resolve.mainFields = ['svelte', 'browser', 'module', 'main']
config.resolve.extensions = ['.mjs', '.js', '.svelte']
config.resolve.alias = {
svelte: path.resolve(__dirname, 'node_modules', 'svelte'),
}
config.module.rules = [
{
test: /\.(png|svg|jpg|gif)$/,
use: ['file-loader']
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: ['file-loader']
},
{
test: /\.(html|svelte)$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader-hot',
options: {
emitCss: true,
hotReload: true
}
}
},
{
test: /\.css$/,
use: [
!isDev ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader'
]
},
{
// Fixes reexport errors when importing Svelte methods
// i.e. `onMount`, `createEventDispatcher`, etc
// -> `Can't reexport the named export 'XYZ' from non EcmaScript module`
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto'
}
]
config.plugins.push(new MiniCssExtractPlugin({
filename: '[name].css'
}))
config.output = {
path: dest,
filename: '[name].js',
chunkFilename: '[name].[id].js'
}
module.exports = config