Skip to content

Commit 8517352

Browse files
committed
Remove amd files from the build
Users can utilize the UMD library if they are still using require.js and if they need to have specific modules, they can consume the cjs or es6 modules via webpack or similar. Fix for #1096
1 parent 63fdb92 commit 8517352

5 files changed

Lines changed: 7 additions & 283 deletions

File tree

FAQ.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@
4747

4848
Should these match, please file an issue with us, per our [issue filing guidelines](https://github.com/wycats/handlebars.js/blob/master/CONTRIBUTING.md#reporting-issues).
4949

50-
1. Why doesn't IE like the `default` name in the AMD module?
51-
52-
Some browsers such as particular versions of IE treat `default` as a reserved word in JavaScript source files. To safely use this you need to reference this via the `Handlebars['default']` lookup method. This is an unfortunate side effect of the shims necessary to backport the Handlebars ES6 code to all current browsers.
53-
5450
1. How do I load the runtime library when using AMD?
5551

56-
There are two options for loading under AMD environments. The first is to use the `handlebars.runtime.amd.js` file. This may require a [path mapping](https://github.com/wycats/handlebars.js/blob/master/spec/amd-runtime.html#L31) as well as access via the `default` field.
57-
58-
The other option is to load the `handlebars.runtime.js` UMD build, which might not require path configuration and exposes the library as both the module root and the `default` field for compatibility.
59-
60-
If not using ES6 transpilers or accessing submodules in the build the former option should be sufficient for most use cases.
52+
The `handlebars.runtime.js` file includes a UMD build, which exposes the library as both the module root and the `default` field for compatibility.

Gruntfile.js

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,6 @@ module.exports = function(grunt) {
4444
},
4545

4646
babel: {
47-
options: {
48-
sourceMaps: 'inline',
49-
loose: ['es6.modules'],
50-
auxiliaryCommentBefore: 'istanbul ignore next'
51-
},
52-
amd: {
53-
options: {
54-
modules: 'amd'
55-
},
56-
files: [{
57-
expand: true,
58-
cwd: 'lib/',
59-
src: '**/!(index).js',
60-
dest: 'dist/amd/'
61-
}]
62-
},
63-
6447
cjs: {
6548
options: {
6649
modules: 'common'
@@ -102,25 +85,6 @@ module.exports = function(grunt) {
10285
}
10386
},
10487

105-
requirejs: {
106-
options: {
107-
optimize: 'none',
108-
baseUrl: 'dist/amd/'
109-
},
110-
dist: {
111-
options: {
112-
name: 'handlebars',
113-
out: 'dist/handlebars.amd.js'
114-
}
115-
},
116-
runtime: {
117-
options: {
118-
name: 'handlebars.runtime',
119-
out: 'dist/handlebars.runtime.amd.js'
120-
}
121-
}
122-
},
123-
12488
uglify: {
12589
options: {
12690
mangle: true,
@@ -160,7 +124,7 @@ module.exports = function(grunt) {
160124
all: {
161125
options: {
162126
build: process.env.TRAVIS_JOB_ID,
163-
urls: ['http://localhost:9999/spec/?headless=true', 'http://localhost:9999/spec/amd.html?headless=true'],
127+
urls: ['http://localhost:9999/spec/?headless=true'],
164128
detailedError: true,
165129
concurrency: 4,
166130
browsers: [
@@ -176,11 +140,12 @@ module.exports = function(grunt) {
176140
sanity: {
177141
options: {
178142
build: process.env.TRAVIS_JOB_ID,
179-
urls: ['http://localhost:9999/spec/umd.html?headless=true', 'http://localhost:9999/spec/amd-runtime.html?headless=true', 'http://localhost:9999/spec/umd-runtime.html?headless=true'],
143+
urls: ['http://localhost:9999/spec/umd.html?headless=true', 'http://localhost:9999/spec/umd-runtime.html?headless=true'],
180144
detailedError: true,
181145
concurrency: 2,
182146
browsers: [
183-
{browserName: 'chrome'}
147+
{browserName: 'chrome'},
148+
{browserName: 'internet explorer', version: 10, platform: 'Windows 8'}
184149
]
185150
}
186151
}
@@ -205,19 +170,17 @@ module.exports = function(grunt) {
205170
'node',
206171
'globals']);
207172

208-
this.registerTask('amd', ['babel:amd', 'requirejs']);
209173
this.registerTask('node', ['babel:cjs']);
210174
this.registerTask('globals', ['webpack']);
211175
this.registerTask('tests', ['concat:tests']);
212176

213-
this.registerTask('release', 'Build final packages', ['eslint', 'amd', 'uglify', 'test:min', 'copy:dist', 'copy:components', 'copy:cdnjs']);
177+
this.registerTask('release', 'Build final packages', ['eslint', 'uglify', 'test:min', 'copy:dist', 'copy:components', 'copy:cdnjs']);
214178

215179
// Load tasks from npm
216180
grunt.loadNpmTasks('grunt-contrib-clean');
217181
grunt.loadNpmTasks('grunt-contrib-concat');
218182
grunt.loadNpmTasks('grunt-contrib-connect');
219183
grunt.loadNpmTasks('grunt-contrib-copy');
220-
grunt.loadNpmTasks('grunt-contrib-requirejs');
221184
grunt.loadNpmTasks('grunt-contrib-uglify');
222185
grunt.loadNpmTasks('grunt-contrib-watch');
223186
grunt.loadNpmTasks('grunt-babel');

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"grunt-contrib-concat": "0.x",
4343
"grunt-contrib-connect": "0.x",
4444
"grunt-contrib-copy": "0.x",
45-
"grunt-contrib-requirejs": "0.x",
4645
"grunt-contrib-uglify": "0.x",
4746
"grunt-contrib-watch": "0.x",
4847
"grunt-eslint": "^17.1.0",
@@ -68,7 +67,7 @@
6867
"jspm": {
6968
"main": "handlebars",
7069
"directories": {
71-
"lib": "dist/amd"
70+
"lib": "dist/cjs"
7271
},
7372
"buildConfig": {
7473
"minify": true

spec/amd-runtime.html

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

spec/amd.html

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

0 commit comments

Comments
 (0)