Skip to content

Commit d95ace9

Browse files
authored
Merge pull request #932 from icxmedia/webpack-instructions
Add webpack loading instructions
2 parents 8b6baae + fb2510e commit d95ace9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,38 @@ Don't forget to load the `schemaForm` module or nothing will happen.
216216
angular.module('myModule', ['schemaForm']);
217217
```
218218

219+
### Webpack loading
220+
In order to import angular-schema-form into your application you will need to
221+
import it as follows:
222+
223+
`import schemaForm from 'angular-schema-form/dist/schema-form.js';`
224+
225+
It is important to override the `main` in the `package.json` as you will need to
226+
utilize the `import-loader` in webpack to import angular-schema-form
227+
dependencies like so.
228+
229+
```js
230+
{
231+
test: require.resolve('angular-schema-form/dist/schema-form.js'),
232+
use: 'imports-loader?tv4,ngSanitize=angular-sanitize,objectPath=objectpath'
233+
}
234+
```
235+
236+
If you use the default minified version it will fail.
237+
238+
If you desire to utilize the embedded `bootstrap-decorator` in this repository
239+
and not the update split out repository, then you will need to update your
240+
webpack configuration as follows to resolve `schemaForm` to the proper path.
241+
242+
`import angularSchemaFormBootstrap from 'angular-schema-form/dist/bootstrap-decorator.js';`
243+
244+
```js
245+
resolve: {
246+
alias:{
247+
schemaForm: 'angular-schema-form/dist/schema-form.js'
248+
}
249+
250+
```
219251
Add-ons
220252
------
221253
There are several add-ons available, for a full list see the [web page](http://textalk.github.io/angular-schema-form/#third-party-addons).

0 commit comments

Comments
 (0)