Skip to content

Commit 2b4aa7e

Browse files
committed
Update babel and webpack
1 parent cb828aa commit 2b4aa7e

10 files changed

+6444
-18045
lines changed

Diff for: Gruntfile.js

+23-3
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,16 @@ module.exports = function (grunt) {
4141
babel: {
4242
options: {
4343
sourceMaps: 'inline',
44-
loose: ['es6.modules'],
45-
auxiliaryCommentBefore: 'istanbul ignore next',
4644
},
4745
cjs: {
46+
options: {
47+
plugins: [
48+
[
49+
'@babel/plugin-transform-modules-commonjs',
50+
{ importInterop: 'none' },
51+
],
52+
],
53+
},
4854
files: [
4955
{
5056
cwd: 'lib/',
@@ -57,11 +63,25 @@ module.exports = function (grunt) {
5763
},
5864
webpack: {
5965
options: {
66+
mode: 'production',
67+
optimization: { minimize: false },
68+
target: 'web',
6069
context: __dirname,
70+
module: {
71+
rules: [
72+
{
73+
test: /\.js$/,
74+
enforce: 'pre',
75+
use: ['source-map-loader'],
76+
},
77+
],
78+
},
6179
output: {
62-
path: 'dist/',
80+
path: __dirname + '/dist/',
6381
library: 'Handlebars',
6482
libraryTarget: 'umd',
83+
libraryExport: 'default',
84+
globalObject: 'this',
6585
},
6686
},
6787
handlebars: {

Diff for: lib/precompiler.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* eslint-env node */
22
/* eslint-disable no-console */
33
import Async from 'neo-async';
4-
import fs from 'fs';
5-
import * as Handlebars from './handlebars';
4+
import * as fs from 'fs';
5+
import Handlebars from './handlebars';
66
import { basename } from 'path';
77
import { SourceMapConsumer, SourceNode } from 'source-map';
88

9-
module.exports.loadTemplates = function (opts, callback) {
9+
export function loadTemplates(opts, callback) {
1010
loadStrings(opts, function (err, strings) {
1111
if (err) {
1212
callback(err);
@@ -21,7 +21,7 @@ module.exports.loadTemplates = function (opts, callback) {
2121
});
2222
}
2323
});
24-
};
24+
}
2525

2626
function loadStrings(opts, callback) {
2727
let strings = arrayCast(opts.string),
@@ -153,7 +153,7 @@ function loadFiles(opts, callback) {
153153
);
154154
}
155155

156-
module.exports.cli = function (opts) {
156+
export function cli(opts) {
157157
if (opts.version) {
158158
console.log(Handlebars.VERSION);
159159
return;
@@ -300,7 +300,7 @@ module.exports.cli = function (opts) {
300300
} else {
301301
console.log(output);
302302
}
303-
};
303+
}
304304

305305
function arrayCast(value) {
306306
value = value != null ? value : [];

0 commit comments

Comments
 (0)