Skip to content
Snippets Groups Projects
Commit d5ff2d2d authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

SSDM-14011 : V3 JS API : provide UMD and ESM bundles - minify new (UMD and...

SSDM-14011 : V3 JS API : provide UMD and ESM bundles - minify new (UMD and ESM) bundles and solve a known problem with minification of RequireJS bundle (change from r.js to uglifyjs to support ES6+ syntax)
parent 36d88ef0
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -24,13 +24,15 @@ cat config.bundle.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" ...@@ -24,13 +24,15 @@ cat config.bundle.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js"
cat config.bundle.min.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/config.bundle.min.js cat config.bundle.min.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/config.bundle.min.js
cat webpack.config.v3api.generate.entry.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/webpack.config.v3api.generate.entry.js cat webpack.config.v3api.generate.entry.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/webpack.config.v3api.generate.entry.js
# install npm dependencies needed for bundles creation
npm install
# create AMD (RequireJS) bundle # create AMD (RequireJS) bundle
node r.js -o $TEMP_DIR/r.config.js baseUrl=$V3_DIR optimize=none out=$TEMP_DIR/openbis.bundle.js node r.js -o $TEMP_DIR/r.config.js baseUrl=$V3_DIR optimize=none out=$TEMP_DIR/openbis.bundle.js
node r.js -o $TEMP_DIR/r.config.js baseUrl=$V3_DIR optimize=uglify out=$TEMP_DIR/openbis.bundle.min.js uglifyjs $TEMP_DIR/openbis.bundle.js -o $TEMP_DIR/openbis.bundle.min.js
# create UMD and ESM bundles # create UMD and ESM bundles
node $TEMP_DIR/webpack.config.v3api.generate.entry.js > $TEMP_DIR/webpack.config.v3api.entry.js node $TEMP_DIR/webpack.config.v3api.generate.entry.js > $TEMP_DIR/webpack.config.v3api.entry.js
npm install
npm run v3api.esm npm run v3api.esm
npm run v3api.umd npm run v3api.umd
......
{ {
"dependencies": {
},
"devDependencies": { "devDependencies": {
"webpack": "^5.75.0", "webpack": "^5.75.0",
"webpack-cli": "^5.0.1" "webpack-cli": "^5.0.1",
"uglify-js": "^3.17.4"
}, },
"scripts": { "scripts": {
"v3api.esm": "webpack-cli --config webpack.config.v3api.module-esm.js", "v3api.esm": "webpack-cli --config webpack.config.v3api.module-esm.js",
"v3api.umd": "webpack-cli --config webpack.config.v3api.module-umd.js" "v3api.umd": "webpack-cli --config webpack.config.v3api.module-umd.js"
} }
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ module.exports = { ...@@ -16,7 +16,7 @@ module.exports = {
} }
}, },
mode: 'development', mode: 'production',
devtool: 'source-map', devtool: 'source-map',
module: { module: {
......
...@@ -13,7 +13,7 @@ module.exports = { ...@@ -13,7 +13,7 @@ module.exports = {
}, },
mode: 'development', mode: 'production',
devtool: 'source-map', devtool: 'source-map',
module: { module: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment