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

GSLUX-608: Generate uglifiable lib build #103

Merged
merged 11 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3
}
]
],
"compact": true
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $ npm run start
- `dev` runs your app for development, reloading on file changes
- `build` builds your app and outputs it in your `dist` directory
- `build-only` builds your app and outputs it in your `dist` directory, but without type checking
- `build:lib:prod` builds custom elements as lib
- `build:lib:prod` builds custom elements as lib and transpiles it to legacy JS to allow minification (uglify) in v3
- `build:lib:dev` builds custom elements as lib with base URL for local dev environnement (`--base=/dev/main`)
- `test`, `test:unit`, `test:unit:ci` runs your test suite with Vitest. See _Unit testing_ section
- `test:e2e`, `test:e2e:ci`, `test:e2e:dev` see _End to end testing_ section
Expand Down Expand Up @@ -57,6 +57,8 @@ In the project **luxembourg-geoportail**, build the app as library with this com
$ npm run build:lib:prod
```

Note: Building in prod mode also transpiles the lib to legacy JS to allow minification (via UglifyJsPlugin) in v3

When using the lib in local developpement mode within the geoportailv3 docker composition, use (this sets the necessary base URL option `--base=/dev/main`):

```
Expand All @@ -69,6 +71,8 @@ To see what are the components exported, check the `/src/bundle/lib.ts` that is

⚠️ This build includes its own **Vue.js** dependencies and will export Vue's utilities such as watchers that can be used to interact with the lib state. For this reason, avoid including another Vue.js dep in the targeted project.

The build configuration can be found in `vite-dist.config`. It excludes `OpenLayers` and `mapbox-gl` from the lib to prevent problems (eg. in minification) when running the lib within v3. The lib uses the `ol` and `mapbox-gl` instances of v3, which versions should be similar to those in v4.

### Import the lib in another app

You can include the built lib multiple ways in the `package.json`:
Expand Down
31 changes: 31 additions & 0 deletions bundle/lux.dist.js

Large diffs are not rendered by default.

41,267 changes: 13,514 additions & 27,753 deletions bundle/lux.dist.mjs

Large diffs are not rendered by default.

589 changes: 58 additions & 531 deletions bundle/lux.dist.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/style.css

Large diffs are not rendered by default.

Loading
Loading