mirror of https://github.com/webpack/webpack.git
42 lines
552 B
Markdown
42 lines
552 B
Markdown
|
# example.js
|
||
|
|
||
|
This example illustrates how to leverage the `import()` syntax to create ContextModules which are separated into separate chunks for each module in the `./templates` folder.
|
||
|
|
||
|
``` javascript
|
||
|
{{example.js}}
|
||
|
```
|
||
|
|
||
|
# templates/
|
||
|
|
||
|
* a.js
|
||
|
* b.js
|
||
|
* c.js
|
||
|
|
||
|
All templates are of this pattern:
|
||
|
|
||
|
``` javascript
|
||
|
module.exports = function() {
|
||
|
return "This text was generated by template X";
|
||
|
}
|
||
|
```
|
||
|
|
||
|
# js/output.js
|
||
|
|
||
|
``` javascript
|
||
|
{{js/output.js}}
|
||
|
```
|
||
|
|
||
|
# Info
|
||
|
|
||
|
## Uncompressed
|
||
|
|
||
|
```
|
||
|
{{stdout}}
|
||
|
```
|
||
|
|
||
|
## Minimized (uglify-js, no zip)
|
||
|
|
||
|
```
|
||
|
{{min:stdout}}
|
||
|
```
|