I have installed proxyquire and my ajax.test.tsx file contains the following code, just 2 lines
import * as proxyquire from 'proxyquire';
proxyquire.noCallThru();
My webpack code is the following
module.exports = {
entry: {
"book.service": './src/book.service.ts',
"ajax.test": './src/ajax.test.tsx'
},
output: {
filename: "[name].js",
path: __dirname + "/dist"
},
devtool: "source-map",
watch: true,
resolve: {
extensions: [".tsx", ".tsx", ".js", ".json", ".ts", '.d.ts']
},
module: {
rules: [
{ test: /\.tsx?$/, loader: "awesome-typescript-loader" },
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
]
},
externals: {
'react/lib/ExecutionEnvironment': true,
'react/addons': true,
'react/lib/ReactContext': 'window'
}
};
I've installed proxyquire & @types/proxyquire. When I run the webpack command it throws up the following error
WARNING in ./~/proxyquire/lib/proxyquire.js
require.extensions is not supported by webpack. Use a loader instead.
@ ./~/proxyquire/index.js 3:17-44
@ ./src/ajax.test.tsx
ERROR in ./~/proxyquire/lib/proxyquire.js
Module not found: Error: Can't resolve 'module' in '***\node_modules\pr
oxyquire\lib'