Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3b89e5
commit 7e82a1a
Showing
8 changed files
with
72 additions
and
31 deletions.
There are no files selected for viewing
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
25 changes: 25 additions & 0 deletions
25
test/function/samples/emit-file/chunk-filename-not-available-buildEnd/_config.js
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,25 @@ | ||
let chunkId; | ||
|
||
module.exports = { | ||
description: 'Throws when accessing the filename before it has been generated in buildEnd', | ||
options: { | ||
input: 'main.js', | ||
plugins: { | ||
name: 'test-plugin', | ||
buildStart() { | ||
chunkId = this.emitFile({ type: 'chunk', id: 'chunk.js' }); | ||
}, | ||
buildEnd() { | ||
this.getFileName(chunkId); | ||
} | ||
} | ||
}, | ||
error: { | ||
code: 'PLUGIN_ERROR', | ||
hook: 'buildEnd', | ||
message: | ||
'Plugin error - Unable to get file name for chunk "chunk.js". Ensure that generate is called first.', | ||
plugin: 'test-plugin', | ||
pluginCode: 'CHUNK_NOT_GENERATED' | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
test/function/samples/emit-file/chunk-filename-not-available-buildEnd/chunk.js
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 @@ | ||
console.log('chunk'); |
1 change: 1 addition & 0 deletions
1
test/function/samples/emit-file/chunk-filename-not-available-buildEnd/main.js
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 @@ | ||
console.log('main'); |
25 changes: 25 additions & 0 deletions
25
test/function/samples/emit-file/chunk-filename-not-available-renderStart/_config.js
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,25 @@ | ||
let chunkId; | ||
|
||
module.exports = { | ||
description: 'Throws when accessing the filename before it has been generated in renderStart', | ||
options: { | ||
input: 'main.js', | ||
plugins: { | ||
name: 'test-plugin', | ||
buildStart() { | ||
chunkId = this.emitFile({ type: 'chunk', id: 'chunk.js' }); | ||
}, | ||
renderStart() { | ||
this.getFileName(chunkId); | ||
} | ||
} | ||
}, | ||
generateError: { | ||
code: 'PLUGIN_ERROR', | ||
hook: 'renderStart', | ||
message: | ||
'Plugin error - Unable to get file name for chunk "chunk.js". Ensure that generate is called first.', | ||
plugin: 'test-plugin', | ||
pluginCode: 'CHUNK_NOT_GENERATED' | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
test/function/samples/emit-file/chunk-filename-not-available-renderStart/chunk.js
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 @@ | ||
console.log('chunk'); |
1 change: 1 addition & 0 deletions
1
test/function/samples/emit-file/chunk-filename-not-available-renderStart/main.js
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 @@ | ||
console.log('main'); |