spyne 0.20.2 → 0.20.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/webpack.config.js CHANGED
@@ -2,28 +2,16 @@
2
2
  const path = require('path');
3
3
  const webpack = require('webpack');
4
4
  const ESLintPlugin = require('eslint-webpack-plugin');
5
- const WebpackRxjsExternals = require('webpack-rxjs-externals');
6
5
  const pkg = require('./package.json');
7
6
 
8
- // We'll define a base config to share options:
7
+ // Shared base config for the UMD build:
9
8
  function baseConfig(mode) {
10
9
  return {
11
10
  mode,
12
11
  devtool: mode === 'production' ? false : 'inline-source-map',
13
- externals: [
14
- WebpackRxjsExternals(),
15
- {
16
- ramda: {
17
- commonjs: 'ramda',
18
- commonjs2: 'ramda',
19
- amd: 'ramda',
20
- root: 'R'
21
- }
22
- }
23
- ],
24
12
  module: {
25
13
  rules: [
26
- // Add Babel or other loaders here if needed
14
+ // Example if you need Babel:
27
15
  // {
28
16
  // test: /\.js$/,
29
17
  // exclude: /node_modules/,
@@ -36,7 +24,6 @@ function baseConfig(mode) {
36
24
  modules: [path.resolve(__dirname, 'node_modules'), 'node_modules']
37
25
  },
38
26
  plugins: [
39
- // Modern replacement for eslint-loader
40
27
  new ESLintPlugin({
41
28
  fix: true,
42
29
  extensions: ['js'],
@@ -46,30 +33,18 @@ function baseConfig(mode) {
46
33
  banner: `spynejs ${pkg.version}\nhttps://spynejs.org\n(c) 2017-present Frank Batista`,
47
34
  entryOnly: true
48
35
  })
49
- ]
36
+ ],
37
+ optimization: {
38
+ // Disabling module concatenation helps avoid the “Cannot read properties of undefined” error
39
+ // when analyzing external modules for scope hoisting:
40
+ concatenateModules: false
41
+ }
50
42
  };
51
43
  }
52
44
 
53
- // ESM Build:
54
- const esmConfig = {
55
- ...baseConfig(process.env.NODE_ENV || 'development'),
56
-
57
- entry: './src/spyne/spyne.js',
58
-
59
- // Enable module output
60
- experiments: {
61
- outputModule: true
62
- },
63
- output: {
64
- path: path.resolve(__dirname, 'lib'),
65
- filename: 'spyne.esm.js',
66
- library: {
67
- type: 'module'
68
- }
69
- }
70
- };
71
-
72
- // UMD Build:
45
+ ////////////////////////////////////////////////
46
+ // UMD Build Only (we rely on Rollup for ESM)
47
+ ////////////////////////////////////////////////
73
48
  const umdConfig = {
74
49
  ...baseConfig(process.env.NODE_ENV || 'development'),
75
50
 
@@ -81,8 +56,42 @@ const umdConfig = {
81
56
  library: 'spyne',
82
57
  libraryTarget: 'umd',
83
58
  umdNamedDefine: true
59
+ },
60
+
61
+ ///////////////////////////////////////////////////////////
62
+ // Externals for ramda, rxjs, dompurify, etc. in UMD build
63
+ ///////////////////////////////////////////////////////////
64
+ externals: {
65
+ // Ramda
66
+ ramda: {
67
+ commonjs: 'ramda',
68
+ commonjs2: 'ramda',
69
+ amd: 'ramda',
70
+ root: 'R'
71
+ },
72
+
73
+ // RxJS
74
+ rxjs: {
75
+ commonjs: 'rxjs',
76
+ commonjs2: 'rxjs',
77
+ amd: 'rxjs',
78
+ root: 'rxjs'
79
+ },
80
+ 'rxjs/operators': {
81
+ commonjs: ['rxjs', 'operators'],
82
+ commonjs2: ['rxjs', 'operators'],
83
+ amd: 'rxjs/operators',
84
+ root: ['rxjs', 'operators']
85
+ },
86
+
87
+ // DOMPurify
88
+ dompurify: {
89
+ commonjs: 'dompurify',
90
+ commonjs2: 'dompurify',
91
+ amd: 'dompurify',
92
+ root: 'DOMPurify'
93
+ }
84
94
  }
85
95
  };
86
96
 
87
- // Export both configs in an array
88
- module.exports = [esmConfig, umdConfig];
97
+ module.exports = umdConfig;