Any chance that this component has different casing in the file? FormPhoneNumberInput. Like FormPhonenumberInput. Linux is case sensitive, and if you are running windows or mac locally, then this error would not occur there (only on forge)
Webpack @ alias not working in app - only when running npm run prod on Forge
For some reason, that I can't seem to figure out, I am getting a swath of errors when deploying a specific app to Forge and running npm run prod in the deployment script.
ℹ Compiling Mix
✔ Mix: Compiled with some errors in 34.39s
ERROR in ./resources/js/Pages/Contacts/Create.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/Pages/Contacts/Create.vue?vue&type=script&lang=js) 1:0-73
Module not found: Error: Can't resolve '@/Components/FormPhoneNumberInput.vue' in '/home/forge/{website url hidden}.com/resources/js/Pages/Contacts'
ERROR in ./resources/js/Pages/Contacts/Create.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/Pages/Contacts/Create.vue?vue&type=script&lang=js) 2:0-51
Module not found: Error: Can't resolve '@/Components/FormInput.vue' in '/home/forge/{website url hidden}.com/resources/js/Pages/Contacts'
continues... there are about 100 more of these errors.
I'm assuming my Webpack alias is not working but this is all using pretty standard Laravel boilerplate.
My webpack.mix.js
const mix = require('laravel-mix');
mix
.js('resources/js/app.js', 'public/js').vue().extract()
.postCss('resources/css/app.css', 'public/css', [
require('postcss-import'),
require('postcss-nested'),
require('tailwindcss'),
])
.webpackConfig(require('./webpack.config'));
if (mix.inProduction()) {
mix.version();
}
My webpack.config.js
const path = require('path');
module.exports = {
resolve: {
alias: {
'@': path.resolve('resources/js'),
},
},
};
My tailwind.config.js
const defaultTheme = require('tailwindcss/defaultTheme');
const colors = require('tailwindcss/colors');
module.exports = {
content: [
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
'./storage/framework/views/*.php',
'./resources/views/**/*.blade.php',
'./resources/js/**/*.vue',
],
theme: {
extend: {
fontFamily: {
sans: ['Roboto', ...defaultTheme.fontFamily.sans],
},
screens: {
'print': {'raw': 'print'},
},
colors: {
green: colors.emerald,
yellow: colors.amber,
purple: colors.violet,
},
},
},
plugins: [],
};
If anyone has a thought, or something else I can try - please let me know. I'm totally stumped as to why this is happening. I have several other apps with the same config that don't seem to have a problem. Also, if I run npm run prod locally, it works without any issue. PHP versions are the same on local and Forge. I even went to far as to bump the Node and NPM version on Forge to match the latest on my system. Nothing seems to be resolving this.
I'm currently stuck having to run npm run prod before deploying which is just annoying.
@fylzero That is indeed very very strange. Did you try logging into the server with ssh and checking if the files are actually there ?
Please or to participate in this conversation.