Forked from nachodd/PhpStorm - Laravel Mix Alias Path Resolve Issue.js
Created
March 14, 2024 15:35
-
-
Save nghuuquyen/bc51f961356b488239a4c97288d86575 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On PhpStorm, when ussing with laravel mix, for Alias path resolving in components you have to: | |
// - create a webpack.config.js file separately like: | |
const path = require('path') | |
const webpack = require('webpack') | |
module.exports = { | |
... | |
resolve: { | |
extensions: ['.js', '.json', '.vue'], | |
alias: { | |
'~': path.resolve(__dirname, './resources/assets/js') | |
} | |
}, | |
... | |
} | |
// And then import it in the webpack.mix.js like: | |
const config = require('./webpack.config') | |
... | |
mix.webpackConfig(config) | |
// Make sure the webpack configuration file is pointed correctly in the configuration of the PhpStorm in: Settings > Languages & Frameworks > Javascript > Webpack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment