What if you remove the slashes at your path?
alias: {
'@myproject': path.resolve(__dirname , 'resources/js')
}
I think only having resources/js in sufficient in your case.
alias: {
'@myproject': path.resolve('resources/js')
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I found many very old posts but with different syntax and people still mentioning that it does not work for them. So I thought I try again.
At the beginning of my webpack.mix.js I have this:
const mix = require('laravel-mix');
const path = require('path')
mix.webpackConfig({
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@myproject': path.resolve(__dirname , '/resources/js/')
},
},
})
/*
Inside my *.vue files I try to import like this:
import FullPageSpinner from '@myproject/components/FullPageSpinner';
I do have only lowercase folders. This is my folder structure:
But I still receive
Error [...] Module not found: Error: Can't resolve '@myproject/components/FullPageSpinner' ..
I am using Docker and are working on Ubuntu 20 It looks like many people have this issue https://github.com/laravel-mix/laravel-mix/issues/1219
Any idea how to fix this?
Please or to participate in this conversation.