When I include vue files in my admin entry, from the sage resources path (@src) - and everything works fine:
admin: [
"@src/vue/index.js",
]
The contents of this index:
import { createApp } from 'vue'
// import the root component App from a single-file component.
import App from './App.vue'
const app = createApp(App)
app.mount('#app')
When I try to include vue files from a different folder, things go sideways:
admin: [
"./components/assets/vue/index.js",
]
├─ ✘ error
│ ModuleParseError: Module parse failed: Unexpected token (1:0)
│ You may need an appropriate loader to handle this file type, currently no loaders are configured to process this
file. See https://webpack.js.org/concepts#loaders
│ > <template>
│ | <h1>Gday!</h1>
│ | </template>
I encountered this with sass files, so I added this in for sass/js outside the @src path:
(Hattip to @kellymears for enlightening me about this on the github issues:)
app.hooks.action(`config.after`, async (app) => {
app.build.rules.js.setInclude([
bud => bud.path('@src'),
app => app.path('./components'),
])
app.build.rules.sass.setInclude([
app => app.path('@src'),
app => app.path('./components'),
])
})
I assumed that adding in another block like so would work, but it does not:
app.build.rules.vue.setInclude([
app => app.path('@src'),
app => app.path('./components'),
])
Can anyone see what I’m doing wrong here?