Skip to content

Commit

Permalink
feature: enable multiple file types per entry
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Timothy Cardenas authored and Timothy Cardenas committed Aug 26, 2019
1 parent 3547917 commit bc24b94
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package/environments/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ const getEntryObject = () => {
paths.forEach((path) => {
const namespace = relative(join(rootPath), dirname(path))
const name = join(namespace, basename(path, extname(path)))
result.set(name, resolve(path))

// Allows for multiple filetypes per entry (https://webpack.js.org/guides/entry-advanced/)
let resultList = result.get(name) || []
resultList.push(resolve(path))
result.set(name, resultList)
})
return result
}
Expand Down

0 comments on commit bc24b94

Please sign in to comment.