Skip to content

Commit

Permalink
fix: plugin name in template string (#2470)
Browse files Browse the repository at this point in the history
* Fix template string

* Add test for plugin name
  • Loading branch information
styfle authored and shellscape committed Sep 21, 2018
1 parent d8a4d7b commit 2d2ae21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/pluginDriver.ts
Expand Up @@ -343,7 +343,7 @@ function uncacheablePluginError(pluginName: string) {
error({
code: 'DUPLICATE_PLUGIN_NAME',
message:
'The plugin name ${pluginName} is being used twice in the same build. Plugin names must be distinct or provide a cacheKey (please post an issue to the plugin if you are a plugin user).'
`The plugin name ${pluginName} is being used twice in the same build. Plugin names must be distinct or provide a cacheKey (please post an issue to the plugin if you are a plugin user).`
});
}

Expand Down
6 changes: 4 additions & 2 deletions test/hooks/index.js
Expand Up @@ -822,19 +822,20 @@ module.exports = input;
]
})
.then(() => {
const name = 'MyTestPluginName';
return rollup
.rollup({
input: 'input',
plugins: [
loader({ input: `alert('hello')` }),
{
name: 'a',
name: name,
buildStart() {
this.cache.set('asdf', 'asdf');
}
},
{
name: 'a',
name: name,
buildStart() {
this.cache.set('asdf', 'asdf');
}
Expand All @@ -844,6 +845,7 @@ module.exports = input;
.catch(err => {
assert.equal(err.code, 'PLUGIN_ERROR');
assert.equal(err.pluginCode, 'DUPLICATE_PLUGIN_NAME');
assert.equal(err.message.includes(name), true)
});
});
});
Expand Down

0 comments on commit 2d2ae21

Please sign in to comment.