I’ve spent the day converting my Sage 9 theme to Sage 10. The final hurdle is allowing my component js files to import from node modules
my js folder structure:
- scripts
app.js
--components
componentFile.js
--routes
routeFile.js
In one of my components, I’m trying to import lodash. I’ve tried both
import _ from 'lodash'
and const _ = require('lodash')
There are no compile errors but _ is undefined in the browser console.
I’ve messed with several of the laravel mix methods but none seem to resolve my issue.
I was hoping setting a custom webpackConfig would help, it didn’t
.webpackConfig({
resolve: {
modules: ['node_modules'],
},
})
Any assistance would be greatly appreciated!
On a side note, how come js router was removed from Sage 10?