Skip to content

Commit 3ef7157

Browse files
committed
upd
1 parent dee51cb commit 3ef7157

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

rollup.config.js

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,51 @@ const esmBundleFor = (platform, opt) => {
109109

110110
const min = minify ? '.min' : '';
111111

112+
const targets = platform === 'node' ? {
113+
node: '18',
114+
} : {
115+
browsers: ['chrome 102'],
116+
}
112117
return {
113118
...cjsBundleFor(platform),
119+
plugins: [
120+
resolve(),
121+
commonjs({
122+
namedExports: {
123+
// '@optimizely/js-sdk-event-processor': ['LogTierV1EventProcessor', 'LocalStoragePendingEventsDispatcher'],
124+
'json-schema': ['validate'],
125+
},
126+
}),
127+
typescript(typescriptPluginOptions),
128+
// babel({
129+
// babelHelpers: 'bundled',
130+
// extensions: ['.js', '.jsx', '.ts', '.tsx'],
131+
// include: ['lib/**/*', 'node_modules/**/*.js'],
132+
// })
133+
],
134+
external: ['https', 'http', 'url'].concat(Object.keys({ ...peerDependencies } || {})),
114135
output: [
115136
{
116137
format: 'es',
117138
file: `dist/index.${platform}.es${min}${ext}`,
118139
plugins: minify ? [terser()] : undefined,
119140
sourcemap: true,
141+
plugins:[
142+
getBabelOutputPlugin({
143+
"presets": [
144+
["@babel/preset-env", {
145+
targets,
146+
// "modules": "umd",
147+
// "allowAllFormats": true,
148+
"useBuiltIns": "usage", // Automatically include required polyfills
149+
"corejs": 3 // Use core-js version 3
150+
// "extensions": [".js", ".jsx", ".ts", ".tsx"],
151+
// "include": ["lib/**/*", "node_modules/**/*"]
152+
}]
153+
]
154+
}
155+
),
156+
],
120157
},
121158
],
122159
}
@@ -189,10 +226,11 @@ const umdBundle = {
189226
name: 'optimizelySdk',
190227
format: 'es',
191228
file: 'dist/optimizely.browser.umd.js',
192-
plugins:[ getBabelOutputPlugin({
193-
// babelHelpers: 'bundled',
194-
configFile: path.resolve(__dirname, '.babelrc'),
195-
})],
229+
plugins:[
230+
getBabelOutputPlugin({
231+
configFile: path.resolve(__dirname, '.babelrc'),
232+
}),
233+
],
196234
exports: 'named',
197235
},
198236
// {
@@ -243,6 +281,7 @@ const bundles = {
243281
'esm-browser-min': esmBundleFor('browser'),
244282
'esm-browser': esmBundleFor('browser', { minify: false }),
245283
'esm-node-min': esmBundleFor('node', { ext: '.mjs' }),
284+
'esm-node': esmBundleFor('node', { minify: false }),
246285
'esm-react-native-min': esmBundleFor('react_native'),
247286
'esm-universal': esmBundleFor('universal'),
248287
'json-schema': jsonSchemaBundle,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy