Answer the question
In order to leave comments, you need to log in
How to import a function as a variable in all modules?
When Webpack builds Typescript modules, it pushes Typescript's __extends helper into each module.
It turns out a lot of repeating helpers in each module.
I'm trying to take out this helper now as a separate f-ii, cut off the generation of helpers through noEmitHelpers.
function __extends(d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
Answer the question
In order to leave comments, you need to log in
extends.ts:
declare let module: any;
function __extends(d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
module.exports = __extends;
resolve: {
modulesDirectories: ['node_modules', '.']
},.
plugins: [
new webpack.ProvidePlugin({
__extends: 'src/ts/ts-helpers/extends' //src/ts/ts-helpers/extens.ts
})
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question