redwoodjs / example-todo

Example Todo app written with Redwood
95 stars 28 forks source link

Add `__filename` to webpack files #9

Closed peterp closed 4 years ago

peterp commented 4 years ago

This adds the __filename "dynamic constant" which is run during compile time. Webpack's DefinePlugin will replace any __filename strings with the absolute path of the current module.

// in `./web/pages/HomePage/Homepage.js`
console.log(__filename)
// will output `/home/dev/hammer/example-todos/web/pages/HomePage/Homepage.js`

We may want to consider using the relative value instead, or only making this available during development.