# @loopback/example-webpack
This example illustrates how to bundle `@loopback/core` using
[webpack](https://webpack.js.org/) to allow LoopBack's Dependency Injection to
run inside a browser.
## Webpack configurations
We add `webpack.config.js` to define two configurations for Node.js and Web.
## Use
Use one of the following commands to build `dist/bundle-web.js` to package this
example application into a JavaScript file for browsers.
```sh
npm run build:webpack-web
```
```sh
npx webpack --config-name web
```
Now `dist/bundle-web.js` can be used for HTML pages, for example:
```html
LoopBack 4 Core Modules WebPack Demo
```
Open `index.html` in a browser, you'll see LoopBack is now running inside the
browser as client-side JavaScript:
```
Hello from LoopBack:
[2020-09-14T07:54:09.220Z] (en) Hello, Jane!
[2020-09-14T07:54:09.227Z] Hello, John!
[2020-09-14T07:54:09.230Z] (zh) 你好,John!
[2020-09-14T07:54:09.231Z] (en) Hello, Jane!
```
## CDN
Once the package is published to npm, we can use `unpkg` as the CDN using one of
the following flavors:
```html
```
## Contributions
- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)
## Tests
Run `npm test` from the root folder.
## Contributors
See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).
## License
MIT