aboutsummaryrefslogtreecommitdiff
path: root/bridge/webpack.config.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-07-02 08:22:55 +0300
committerGravatar Vitaly Takmazov2023-07-02 08:42:12 +0300
commitec805392cbb2e91b107e0203b250db6ba08644ba (patch)
treec301a4e818852169c23a98d6f57cf69e0e3b679a /bridge/webpack.config.js
parent813d37ff165f4bfb130529663ae7a2290053a604 (diff)
bridge: slimmed-down oembed server
Diffstat (limited to 'bridge/webpack.config.js')
-rw-r--r--bridge/webpack.config.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/bridge/webpack.config.js b/bridge/webpack.config.js
new file mode 100644
index 00000000..9467224d
--- /dev/null
+++ b/bridge/webpack.config.js
@@ -0,0 +1,70 @@
+const ESLintPlugin = require('eslint-webpack-plugin')
+const TerserPlugin = require('terser-webpack-plugin')
+
+module.exports = () => {
+ const node_env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'
+ const dev = node_env !== 'production'
+ const config = {
+ mode: node_env,
+ devtool: dev ? 'cheap-module-source-map' : false,
+ entry: {
+ 'bridge': [
+ __dirname + '/index.js'
+ ]
+ },
+ target: 'node',
+ output: {
+ path: __dirname + '/../public',
+ filename: '[name].js'
+ },
+ module: {
+ rules: [{
+ test: /\.js$/,
+ exclude: [
+ /node_modules/
+ ],
+ loader: 'babel-loader'
+ }, {
+ test: /\.(png|jpe?g|gif|svg)$/i,
+ type: 'asset/resource'
+ }]
+ },
+ plugins: [
+ ],
+ resolve: {
+ symlinks: false,
+ extensions: ['.js']
+ }
+ }
+ if (dev) {
+ config.plugins.push(
+ new ESLintPlugin({
+ files: __dirname + '/src',
+ lintDirtyModulesOnly: true,
+ failOnWarning: false,
+ failOnError: true,
+ fix: false
+ }))
+ config.devServer = {
+ hot: true,
+ historyApiFallback: true,
+ client: {
+ overlay: {
+ runtimeErrors: true
+ }
+ }
+ }
+ }
+ config.optimization = {
+ minimize: !dev,
+ minimizer: [
+ new TerserPlugin({
+ minify: TerserPlugin.swcMinify,
+ // `terserOptions` options will be passed to `swc` (`@swc/core`)
+ // Link to options - https://swc.rs/docs/config-js-minify
+ terserOptions: {},
+ }),
+ ]
+ }
+ return config
+}