Skip to content

Commit 823d61d

Browse files
committed
First stab at ES2015 with webpack and babel
I tried to keep it simple, so no gulp scripts just npm run. WARNING: work in progress. Tests aren't fixed and I haven't actually tried it in a browser. But it transpiles ES2015 modules and code and bundles it up in an UMD wrapped bundle. To transpile and bundle dist/schema-form.js and minify to dist/ $ npm run dist To watch and rebuild bundle under dist/ $ npm run watch Just minify $ npm run minify How does it work? Well, webpack is pointed agains src/module.js, that in turn include all files that is needed. Webpack calls babel to transpile them and then bundles them in one large file. This means we can use ES2015 which is really nice. I haven't included the babel polyfill and it would be nice if we could keep that as an optional dependency. If we keep away from Symbol, array destructing (object destructing is fine), for-of loops and generators I think the transpiling is enough and that we won't need to include a polyfill. This would be the first step to break out code into plain vanilla js modules that doesn't need angular at all. A note on externals: I've configured webpack to include externals from global scope, i.e. tv4, objectpath and angular. So they aren't bundled with dist/schema-form.js. objectpath might be a problem here since it uses different names depedning on the way you include it, ie.e "objectpath" when included as a module, or "ObjectPath" when using a regular script tag. This might need to be fixed upstream, or we could bundle it with ASF.
1 parent e35cdde commit 823d61d

23 files changed

+4080
-3752
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"es2015"
4+
]
5+
}

.jshintrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
"unused": true,
44
"browser": true,
55
"globals": {
6-
"ObjectPath": false,
76
"console":false,
8-
"jQuery": false,
9-
"$":false,
107
"assertEquals": false,
118
"jstestdriver": false,
129
"assertTrue": false,
@@ -17,7 +14,6 @@
1714
"sinon":false,
1815
"beforeEach": false,
1916
"afterEach": false,
20-
"angular": false,
2117
"module": false,
2218
"inject": false,
2319
"chai": false,

0 commit comments

Comments
 (0)