Skip to content

Commit 000cc33

Browse files
author
Timothy Cardenas
committed
feature: enable multiple file types per entry
It is possible to provide different types of files when using an array of values for entry to achieve separate bundles for CSS and JavaScript (and other) files in applications that are not using import for styles in JavaScript (pre Single Page Applications or different reasons). For additional info: https://webpack.js.org/guides/entry-advanced/ This is particularly useful if you are migrating from a per page css/js organization as was common with rails <= 6
1 parent d410d01 commit 000cc33

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

package/environments/base.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ const getEntryObject = () => {
6565
paths.forEach((path) => {
6666
const namespace = relative(join(rootPath), dirname(path))
6767
const name = join(namespace, basename(path, extname(path)))
68-
result.set(name, resolve(path))
68+
69+
// Allows for multiple filetypes per entry (https://webpack.js.org/guides/entry-advanced/)
70+
let resultList = result.get(name) || []
71+
resultList.push(resolve(path))
72+
result.set(name, resultList)
6973
})
7074
return result
7175
}

0 commit comments

Comments
 (0)