Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.

Commit 6fd5d39

Browse files
committed
Merge branch 'tests'
2 parents 4e34809 + e2a4614 commit 6fd5d39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+4664
-849
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
node_js:
3+
- "8"
4+
cache: yarn

README.md

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Closure library dependency loader for [Webpack](http://webpack.github.io/)
22

3-
[![Dependency Status](https://david-dm.org/mxmul/closure-loader.svg)](https://david-dm.org/mxmul/closure-loader)
4-
[![npm version](https://badge.fury.io/js/closure-loader.svg)](https://badge.fury.io/js/closure-loader)
3+
[![npm][npm]][npm-url]
4+
[![deps][deps]][deps-url]
5+
[![test][test]][test-url]
56

67
This is a webpack loader which resolves `goog.provide()` and `goog.require()` statements in webpack
78
just like if they were regular CommonJS modules.
@@ -117,31 +118,26 @@ Here are the configuration options specific for this loader:
117118
- **fileExt** (string, default: '.js'): Files extension which will be searched for dependency resolving.
118119
Support [glob](https://github.com/isaacs/node-glob) pattern syntax.
119120

120-
## Examples
121-
In the hopes of clarifying the usage of the loader a bit I have provided a couple of examples which
122-
you can find in the `examples` directory.
123-
124-
To run an example please follow these steps:
125-
- `npm install` in the closure-loader root directory
126-
- `npm install` in the directory of the example
127-
- `npm start` or `npm run build` in the directory of the example
128-
129-
The following examples are available:
130-
- **common-js**: This example shows how to load some legacy code that contains `goog.provide()` and
131-
`goog.require()` via commonJs `require()` calls.
132-
- **common-js-closure-lib**: This example shows how to load the closure library via commonJs
133-
`require()` calls.
134-
- **es6**: This example shows how to load some legacy code that contains `goog.provide()` and
135-
`goog.require()` via babel and es6 `import` calls.
136-
- **es6-closure-lib**: This example shows how to load the closure library via babel and es6
137-
`import` calls.
138-
- **es6-fileext**: Demonstrates how different filetypes can be used using the fileExt option.
139-
- **es6-webpack2**: Demonstrates how this loader can be used with webpack2
140-
- **legacy-closure-lib**: This example shows how to load the closure library via your own `goog.require()`
141-
calls. This is not advised. If you are using webpack you should think about using a proper module loader,
142-
preferably es6 as this is now the standard.
143-
144-
**NOTE**: This loader does in no way include or wrap the actual google closure library. If you want to use the closure library you will have to include it yourself and ensure correct shimming. See the above examples on how this can be done.
121+
**NOTE**: This loader does in no way include or wrap the actual google closure library. If you want to use the closure library you will have to include it yourself and ensure correct shimming:
122+
123+
```javascript
124+
module: {
125+
rules: [
126+
{
127+
test: /google-closure-library\/closure\/goog\/base/,
128+
use: [
129+
'imports-loader?this=>{goog:{}}&goog=>this.goog',
130+
'exports-loader?goog',
131+
],
132+
},
133+
],
134+
},
135+
plugins: [
136+
new webpack.ProvidePlugin({
137+
goog: 'google-closure-library/closure/goog/base',
138+
}),
139+
]
140+
```
145141

146142
## Authors
147143

@@ -153,3 +149,12 @@ See also the list of [contributors](https://github.com/mxmul/closure-loader/grap
153149
## License
154150

155151
MIT (http://www.opensource.org/licenses/mit-license.php)
152+
153+
[npm]: https://img.shields.io/npm/v/closure-loader.svg
154+
[npm-url]: https://npmjs.com/package/closure-loader
155+
156+
[deps]: https://david-dm.org/mxmul/closure-loader.svg
157+
[deps-url]: https://david-dm.org/mxmul/closure-loader
158+
159+
[test]: http://img.shields.io/travis/mxmul/closure-loader.svg
160+
[test-url]: https://travis-ci.org/mxmul/closure-loader

examples/common-js-closure-lib/package.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/common-js-closure-lib/src/index.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/common-js-closure-lib/webpack.config.js

Lines changed: 0 additions & 68 deletions
This file was deleted.

examples/common-js/package.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/common-js/src/app.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/common-js/src/index.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/common-js/webpack.config.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

examples/es6-closure-lib/package.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)