admin管理员组

文章数量:1327691

I am trying to integrate TypeScript into Webpack and am looking for some @types that will help with all the Webpack specific stuff.

I was using declare function require(string): any; to use fe.: require('some.scss') but quickly got annoyed with adding it directly or over the /// <reference path="... syntax and was hoping that there is a better way to do this.

The ideal thing would be just npm i @types/webpack but that package only seems to be for the Webpack config file which I think is totally useless...

to be more specific, I am trying to get this code to work in TypeScript:

require.ensure([
    require('./first')
], function(require) {
    require('./second')
}, 'second');

I am trying to integrate TypeScript into Webpack and am looking for some @types that will help with all the Webpack specific stuff.

I was using declare function require(string): any; to use fe.: require('some.scss') but quickly got annoyed with adding it directly or over the /// <reference path="... syntax and was hoping that there is a better way to do this.

The ideal thing would be just npm i @types/webpack but that package only seems to be for the Webpack config file which I think is totally useless...

to be more specific, I am trying to get this code to work in TypeScript:

require.ensure([
    require('./first')
], function(require) {
    require('./second')
}, 'second');
Share Improve this question edited Jan 12, 2017 at 13:56 Liam 29.8k28 gold badges138 silver badges202 bronze badges asked Jan 12, 2017 at 13:50 BrendanMullinsBrendanMullins 5873 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11

These are available in @types/webpack-env

npm install --save-dev @types/webpack-env

本文标签: javascriptHow to use Webpacks 39require39 and 39requireensure39 in TypesScriptStack Overflow