-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rollup): support multiple entry points
- Loading branch information
Showing
7 changed files
with
211 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
module.exports = { | ||
output: { | ||
name: 'bundle', | ||
}, | ||
plugins: [], | ||
}; |
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,17 @@ | ||
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") | ||
load("@npm_bazel_rollup//:index.from_src.bzl", "rollup_bundle") | ||
|
||
rollup_bundle( | ||
name = "bundle", | ||
entry_points = { | ||
"entry1.js": "one", | ||
"entry2.js": "two", | ||
}, | ||
) | ||
|
||
jasmine_node_test( | ||
name = "test", | ||
srcs = ["spec.js"], | ||
data = ["@npm//source-map"], | ||
deps = [":bundle"], | ||
) |
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,3 @@ | ||
const hello1 = document.createElement('span'); | ||
hello1.innerText = 'hello from entry point 1'; | ||
window.document.body.appendChild(hello1); |
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,3 @@ | ||
const hello2 = document.createElement('span'); | ||
hello2.innerText = 'hello from entry point 2'; | ||
window.document.body.appendChild(hello1); |
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,8 @@ | ||
const fs = require('fs'); | ||
|
||
describe('rollup multiple entry points', () => { | ||
it('should produce a chunk for each entry point', () => { | ||
expect(fs.existsSync(require.resolve(__dirname + '/bundle/one.js'))).toBeTruthy(); | ||
expect(fs.existsSync(require.resolve(__dirname + '/bundle/two.js'))).toBeTruthy(); | ||
}); | ||
}); |