Skip to content

Commit 19614c9

Browse files
committed
Fixes less#3533
1 parent 2870163 commit 19614c9

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/less/Gruntfile.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ module.exports = function(grunt) {
190190
// Handle async / await in Rollup build for tests
191191
// Remove this when Node 6 is no longer supported for the build/test process
192192
const nodeVersion = semver.major(process.versions.node);
193+
const tsNodeRuntime = path.resolve(path.join('node_modules', '.bin', 'ts-node'));
193194
let scriptRuntime = 'node';
194195
if (nodeVersion < 8) {
195-
scriptRuntime = path.resolve(path.join('node_modules', '.bin', 'ts-node'));
196+
scriptRuntime = tsNodeRuntime;
196197
}
197198

198199
// Project configuration.
@@ -228,7 +229,10 @@ module.exports = function(grunt) {
228229
command: scriptRuntime + " build/rollup.js --browser --out=./tmp/browser/less.min.js"
229230
},
230231
test: {
231-
command: "node test/index.js"
232+
command: [
233+
tsNodeRuntime + " test/test-es6.ts",
234+
"node test/index.js"
235+
].join(' && ')
232236
},
233237
generatebrowser: {
234238
command: 'node test/browser/generator/generate.js'

packages/less/src/less/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,14 @@ export default (environment, fileManagers) => {
8888
}
8989
}
9090

91+
/**
92+
* Some of the functions assume a `this` context of the API object,
93+
* which causes it to fail when wrapped for ES6 imports.
94+
*
95+
* An assumed `this` should be removed in the future.
96+
*/
97+
initial.parse = initial.parse.bind(api);
98+
initial.render = initial.render.bind(api);
99+
91100
return api;
92101
};

0 commit comments

Comments
 (0)