Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension - tips - How to avoid minimize with webpack #545

Closed
Gaetanbrl opened this issue Jun 22, 2022 · 1 comment
Closed

Extension - tips - How to avoid minimize with webpack #545

Gaetanbrl opened this issue Jun 22, 2022 · 1 comment

Comments

@Gaetanbrl
Copy link
Contributor

Gaetanbrl commented Jun 22, 2022

Hi,

I need to debug an extension in ms2-georchestra without horrific minify code in test env (e.g urb@map, but will works with cadastrapp or wathever) and i think i get a solution.

First, we have to know that npm run ext:buid command always build extension in prod mode.
I dunno if this is due to MS2 but i'm sur it's just because many use cases build an extension to works in prod env.

So, here my tips, not sur it's the best (but it seems to works) :

  1. Change build script command
    https://github.com/geosolutions-it/MapStoreExtension/blob/master/package.json#L128

By this command with --env mode=true :

"ext:build": "rimraf ./dist && mkdirp ./dist && webpack --env mode=true --progress --color --config build/extension/prod-webpack.config.js",

  1. Open build/extension/prod-webpack.config.js:

Change this last line :

module.exports = createExtensionWebpackConfig({ prod: true, name, ...commons, plugins});

by this line to use env.mod value from package.json file inserted before) ....

module.exports = env => createExtensionWebpackConfig({ prod: !env.mode === 'false', name, ...commons, plugins });

  1. Run npm run ext:build command

  2. Deploy zip extension as usual

So, all files are always in only one javascript file (in browser source console tab) but the code is more... readable as exepected in local dev env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants