Officially support more elaborate externals
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, rollup
- Área
- build-system, cli
Línea de trabajo
Comienza con el manejo de external y exclude en src/index.js#L387-L388 y, después, revisa el comportamiento propuesto en el issue para --external y --external-glob en la línea de comandos. Se considera terminado cuando la semántica de configuración elegida esté implementada y documentada, incluido cómo se tratan las dependencias y los imports no estándar.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
This is a feature request/Proposal
As a user of microbundle I want ways to configure which imports are to be considered external.
In order to reduce my bundle size and also to work with non-standard imports (images, fonts, ...) that are not supported by microbundle.
Status Quo
- As described in https://github.com/developit/microbundle/issues/283#issuecomment-523879163, there is a (I guess unoffical) way to use regex in the
--excludeflag, which can be used to have rollup treat specific import statements as external. - Presence of the
--excludeflag triggers if pkg.dependencies are treated as external or not (see index.js#L387) I find that quite confusing and the behaviour is not documented.
Problem
Given I want to use --external .*/assets/.* to work with non-standard imports
And I also want all my dependencies to be excluded
Then I need to add all dependencies to --external causing code duplication and manual overhead.
Proposal
In order to fix the problem and reduce confusion I propose to have it work like this:
$ microbundle
Exclude dependencies, peerDependencies
$ microbundle --external .*/assets/.*
Exclude dependencies, peerDependencies and .*/assets/.*
And explicitly support regular expressions or globs under --external
$ microbundle --external .*/assets/.*,angular --include-dependencies
Exclude peerDependencies and .*/assets/.*
All normal dependencies ecxept angular are included in the bundle
Non-breaking alternative
I realize that the above proposal is really tied to my personal usecase of (miss-?)using --external for non-standard imports.
It would also introduce a potential pretty impactful breaking change (since users of microbundle might ship bundles that lack bundled dependencies).
Alternatively the current behaviour could stay as is, using regex in --external will be considered hacky. And we introduce a new, documented way to exclude assets:
$ microbundle --external-glob **/*.(jpg|png)
Exclude dependencies, peerDependencies and all imports matching **/*.(jpg|png)
$ microbundle --external angular --external-glob **/*.(jpg|png)
Exclude peerDependencies, angular, and all imports matching **/*.(jpg|png)
Let me know what you think about this. I would be really happy to implement the changes and provide a PR.
- Lenguaje dominante
- JavaScript
- Estrellas
- 8.1k
- Forks
- 358
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de developit/microbundle
-
CSS
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
developit/microbundle#1002 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
developit/microbundle#789 · 1 comentario ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
developit/microbundle#1100 · 4 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
developit/microbundle#1094 · 1 comentario ·
-
Disable minification by default Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
developit/microbundle#1093 · 3 comentarios · 1 reacción ·
Todos los issues de developit/microbundle
Issues similares
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Improve Title Support Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·