Skip to content

Commit c0da79c

Browse files
committed
add test for issue #388
1 parent 3490ca6 commit c0da79c

File tree

11 files changed

+128
-0
lines changed

11 files changed

+128
-0
lines changed

test/comparison-tests/issue388/app.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { foo } from './main';
2+
3+
console.log(foo());
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export declare function populateClientExports(exports: any): void;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function populateClientExports(exports) {
2+
exports.foo = require('./foo').foo;
3+
}
4+
exports.populateClientExports = populateClientExports;
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId])
10+
/******/ return installedModules[moduleId].exports;
11+
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ exports: {},
15+
/******/ id: moduleId,
16+
/******/ loaded: false
17+
/******/ };
18+
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
22+
/******/ // Flag the module as loaded
23+
/******/ module.loaded = true;
24+
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
29+
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
36+
/******/ // __webpack_public_path__
37+
/******/ __webpack_require__.p = "";
38+
39+
/******/ // Load entry module and return exports
40+
/******/ return __webpack_require__(0);
41+
/******/ })
42+
/************************************************************************/
43+
/******/ ([
44+
/* 0 */
45+
/***/ function(module, exports, __webpack_require__) {
46+
47+
"use strict";
48+
var main_1 = __webpack_require__(1);
49+
console.log(main_1.foo());
50+
51+
52+
/***/ },
53+
/* 1 */
54+
/***/ function(module, exports, __webpack_require__) {
55+
56+
var populateClientExports = __webpack_require__(2).populateClientExports;
57+
populateClientExports(exports);
58+
59+
/***/ },
60+
/* 2 */
61+
/***/ function(module, exports, __webpack_require__) {
62+
63+
function populateClientExports(exports) {
64+
exports.foo = __webpack_require__(3).foo;
65+
}
66+
exports.populateClientExports = populateClientExports;
67+
68+
/***/ },
69+
/* 3 */
70+
/***/ function(module, exports) {
71+
72+
function foo() {
73+
return 'foo';
74+
}
75+
76+
exports.foo = foo;
77+
78+
/***/ }
79+
/******/ ]);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Asset Size Chunks Chunk Names
2+
bundle.js 2.01 kB 0 [emitted] main
3+
chunk {0} bundle.js (main) 376 bytes [rendered]
4+
[0] ./.test/issue388/app.ts 73 bytes {0} [built]
5+
[1] ./.test/issue388/main.js 109 bytes {0} [built]
6+
[2] ./.test/issue388/clientExports.js 138 bytes {0} [built]
7+
[3] ./.test/issue388/foo.js 56 bytes {0} [built]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export declare function foo(): string;

test/comparison-tests/issue388/foo.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function foo() {
2+
return 'foo';
3+
}
4+
5+
exports.foo = foo;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './foo';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var populateClientExports = require('./clientExports').populateClientExports;
2+
populateClientExports(exports);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"allowJs": true
5+
}
6+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var path = require('path')
2+
3+
module.exports = {
4+
entry: './app.ts',
5+
output: {
6+
filename: 'bundle.js'
7+
},
8+
resolve: {
9+
extensions: ['', '.ts', '.js']
10+
},
11+
module: {
12+
loaders: [
13+
{ test: /\.ts$/, loader: 'ts-loader' }
14+
]
15+
}
16+
}
17+
18+
// for test harness purposes only, you would not need this in a normal project
19+
module.exports.resolveLoader = { alias: { 'ts-loader': require('path').join(__dirname, "../../index.js") } }

0 commit comments

Comments
 (0)