Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update babel and webpack #2005

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ module.exports = function (grunt) {
babel: {
options: {
sourceMaps: 'inline',
loose: ['es6.modules'],
auxiliaryCommentBefore: 'istanbul ignore next',
},
cjs: {
options: {
plugins: [
[
'@babel/plugin-transform-modules-commonjs',
{ importInterop: 'none' },
],
],
},
files: [
{
cwd: 'lib/',
Expand All @@ -57,11 +63,25 @@ module.exports = function (grunt) {
},
webpack: {
options: {
mode: 'production',
optimization: { minimize: false },
target: 'web',
context: __dirname,
module: {
rules: [
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
},
],
},
output: {
path: 'dist/',
path: __dirname + '/dist/',
library: 'Handlebars',
libraryTarget: 'umd',
libraryExport: 'default',
globalObject: 'this',
},
},
handlebars: {
Expand Down
12 changes: 6 additions & 6 deletions lib/precompiler.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-env node */
/* eslint-disable no-console */
import Async from 'neo-async';
import fs from 'fs';
import * as Handlebars from './handlebars';
import * as fs from 'fs';
import Handlebars from './handlebars';
import { basename } from 'path';
import { SourceMapConsumer, SourceNode } from 'source-map';

module.exports.loadTemplates = function (opts, callback) {
export function loadTemplates(opts, callback) {
loadStrings(opts, function (err, strings) {
if (err) {
callback(err);
Expand All @@ -21,7 +21,7 @@ module.exports.loadTemplates = function (opts, callback) {
});
}
});
};
}

function loadStrings(opts, callback) {
let strings = arrayCast(opts.string),
Expand Down Expand Up @@ -153,7 +153,7 @@ function loadFiles(opts, callback) {
);
}

module.exports.cli = function (opts) {
export function cli(opts) {
if (opts.version) {
console.log(Handlebars.VERSION);
return;
Expand Down Expand Up @@ -300,7 +300,7 @@ module.exports.cli = function (opts) {
} else {
console.log(output);
}
};
}

function arrayCast(value) {
value = value != null ? value : [];
Expand Down
Loading
Loading