-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
79 lines (75 loc) · 2.72 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
const webpack = require('webpack');
const path = require('path');
// eslint-disable-next-line no-unused-vars
module.exports = function (env) {
return [{
target: "node",
entry: {
mdne: [
path.resolve(__dirname, 'lib/main.mjs')
]
},
output: {
library: 'mdne',
libraryTarget: 'commonjs2',
filename: '[name].js',
path: path.resolve(__dirname, 'bin'),
devtoolModuleFilenameTemplate: '../[resource-path]',
// devtoolModuleFilenameTemplate: void 0
},
resolve: {
// TODO:
// ERROR in ./node_modules/red-agate-react-host/modules/react-host.mjs 11:15-50
// Can't import the named export 'renderToStaticMarkup' from non EcmaScript module (only default export is available)
// ERROR in ./node_modules/red-agate-util/modules/runtime/require-dynamic.mjs 7:56-74
// Can't import the namespace object from non EcmaScript module (only default export is available)
//
// TODO:
// The priority of '.js' must be higher than '.mjs'.
// If '.mjs' is higher, some errors will occur.
// * 'renderToStaticMarkup' (red-agate-react-host/modules/react-host.mjs)
// * CSS files are not bundled.
//
// extensions: ['.tsx', '.ts', '.jsx', '.mjs', '.cjs', '.js']
extensions: ['.js', '.mjs']
},
module: {
rules: [{
test: /\.m?js$/,
use: [
'babel-loader',
require.resolve('@open-wc/webpack-import-meta-loader'),
],
resolve: {
fullySpecified: false,
},
// eslint-disable-next-line no-useless-escape
exclude: /node_modules[\/\\](?!(menneu|liyad|red-agate)).*$/
}, {
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
}, {
enforce: 'pre',
test: /\.m?js$/,
use: {
loader: 'source-map-loader',
options: {
}
},
// eslint-disable-next-line no-useless-escape
exclude: /node_modules[\/\\](?!(menneu|liyad|red-agate)).*$/
}, {
test: /\.css$/,
use: [
'raw-loader'
]
}]
},
plugins: [
new webpack.BannerPlugin({ banner: "#!/usr/bin/env node", raw: true })
],
devtool: 'source-map'
},
]}