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
1 Answer
Reset to default 11These are available in @types/webpack-env
npm install --save-dev @types/webpack-env
本文标签: javascriptHow to use Webpacks 39require39 and 39requireensure39 in TypesScriptStack Overflow
版权声明:本文标题:javascript - How to use Webpacks 'require' and 'require.ensure' in TypesScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742214758a2434363.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论