@@ -26,7 +26,6 @@ const cjsBuildFor = (platform) => ({
26
26
plugins : [
27
27
resolve ( ) ,
28
28
commonjs ( ) ,
29
- visualizer ( ) ,
30
29
] ,
31
30
external : [ 'https' , 'http' , 'url' ] . concat ( Object . keys ( dependencies || { } ) ) ,
32
31
input : `lib/index.${ platform } .js` ,
@@ -54,8 +53,39 @@ const esmBundle = {
54
53
} ]
55
54
}
56
55
56
+ // ESM Bundle for browsers with all optimizely deps included
57
+ const esmFullBundle = {
58
+ input : 'lib/index.browser.js' ,
59
+ external : [ 'https' , 'http' , 'url' ] ,
60
+ plugins : [
61
+ resolve ( { browser : true } ) ,
62
+ commonjs ( {
63
+ namedExports : {
64
+ '@optimizely/js-sdk-logging' : [
65
+ 'ConsoleLogHandler' ,
66
+ 'getLogger' ,
67
+ 'setLogLevel' ,
68
+ 'LogLevel' ,
69
+ 'setLogHandler' ,
70
+ 'setErrorHandler' ,
71
+ 'getErrorHandler' ,
72
+ ] ,
73
+ '@optimizely/js-sdk-event-processor' : [
74
+ 'LogTierV1EventProcessor' ,
75
+ 'LocalStoragePendingEventsDispatcher' ,
76
+ ]
77
+ }
78
+ } ) ,
79
+ ] ,
80
+ output : {
81
+ format : 'es' ,
82
+ file : 'dist/optimizely.browser.es.full.js' ,
83
+ sourcemap : true ,
84
+ } ,
85
+ }
86
+
57
87
const esmSlimBundle = {
58
- ...esmBundle ,
88
+ ...esmFullBundle ,
59
89
plugins : [
60
90
alias ( { entries : [
61
91
{ find : './project_config_schema' ,
@@ -65,7 +95,8 @@ const esmSlimBundle = {
65
95
{ find : / .* \/ e n u m s $ / ,
66
96
replacement : path . resolve ( __dirname , 'ext/enums.js' ) }
67
97
] } ) ,
68
- ...esmBundle . plugins
98
+ ...esmFullBundle . plugins ,
99
+ visualizer ( ) ,
69
100
] ,
70
101
output : {
71
102
format : 'es' ,
@@ -136,6 +167,7 @@ const bundles = {
136
167
'cjs-browser' : cjsBuildFor ( 'browser' ) ,
137
168
'cjs-react-native' : cjsBuildFor ( 'react_native' ) ,
138
169
'esm' : esmBundle ,
170
+ 'esm-full' : esmFullBundle ,
139
171
'esm-slim' : esmSlimBundle ,
140
172
'json-schema' : jsonSchemaBundle ,
141
173
'umd' : umdBundle ,
0 commit comments