Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
less cryptic error if entry module is external
- Loading branch information
Showing
8 changed files
with
369 additions
and
181 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
description: 'prints useful error if external returns true for entry (#1264)', | ||
options: { | ||
external: id => true | ||
}, | ||
error: { | ||
code: 'UNRESOLVED_ENTRY', | ||
message: 'Entry module cannot be external' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import ext from 'external'; | ||
assert.equal( ext, 42 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,41 @@ | ||
const path = require('path') | ||
const weak = require('weak') | ||
const rollup = require('../..') | ||
var path = require('path') | ||
var rollup = require('../..') | ||
|
||
let shouldCollect = false; | ||
let isCollected = false; | ||
try { | ||
var weak = require('weak') | ||
|
||
const onCollect = () => isCollected = true; | ||
var shouldCollect = false; | ||
var isCollected = false; | ||
|
||
let cache; | ||
const run = () => rollup.rollup({ | ||
entry: path.resolve(__dirname, 'index.js'), | ||
cache | ||
}).then(bundle => { | ||
weak(bundle, onCollect); | ||
cache = bundle; | ||
global.gc(); | ||
if (shouldCollect && !isCollected) { | ||
throw new Error('Memory leak detected') | ||
function onCollect () { | ||
isCollected = true; | ||
} | ||
shouldCollect = true; | ||
}) | ||
|
||
run().then(run).then(() => console.log('Success')).catch((err) => { | ||
console.error(err.message); | ||
process.exit(1); | ||
}); | ||
var cache; | ||
function run () { | ||
return rollup.rollup({ | ||
entry: path.resolve(__dirname, 'index.js'), | ||
cache | ||
}).then(function (bundle) { | ||
weak(bundle, onCollect); | ||
cache = bundle; | ||
global.gc(); | ||
if (shouldCollect && !isCollected) { | ||
throw new Error('Memory leak detected') | ||
} | ||
shouldCollect = true; | ||
}); | ||
}; | ||
|
||
run() | ||
.then(run) | ||
.then(function () { | ||
console.log('Success'); | ||
}). | ||
catch(function (err) { | ||
console.error(err.message); | ||
process.exit(1); | ||
}); | ||
} catch (err) { | ||
console.log(`skipping memory leak test`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters