Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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
@PaxExterminatus

This comment has been minimized.

Copy link

PaxExterminatus commented Jun 14, 2019

Thanks a great solution.
Can I provide this for my team using the git repository?

@nachodd

This comment has been minimized.

Copy link
Owner Author

nachodd commented Jun 14, 2019

Of course man! I'm glad it helped you :)
Come on, spread the word!

@kslr

This comment has been minimized.

Copy link

kslr commented Sep 30, 2019

cool

@bnd170

This comment has been minimized.

Copy link

bnd170 commented Dec 11, 2019

Works properly. Thanks!

@nachodd

This comment has been minimized.

Copy link
Owner Author

nachodd commented Dec 11, 2019

You're welcome! 😁

@codisfy

This comment has been minimized.

Copy link

codisfy commented Mar 3, 2020

Thanks !!

@plweil

This comment has been minimized.

Copy link

plweil commented Apr 10, 2020

I'm a little confused. I already have a webpack.config.js file that was put in by laravel-mix (don't you?). How do I integrate your code? If I just paste it in, and then import it into webpack.mix.js, nothing works. The existing webpack.config.js looks like this (minus the comments):

require(__dirname + '/node_modules/laravel-mix/src/index');

Mix.paths.setRootPath( path.resolve(__dirname) );

require(Mix.paths.mix());

Mix.dispatch('init', Mix);

let WebpackConfig = require(__dirname + '/node_modules/laravel-mix/src/builder/WebpackConfig');

module.exports = new WebpackConfig().build();

@waltersteven

This comment has been minimized.

Copy link

waltersteven commented Jun 4, 2020

Thanks @nachodd! It worked in PhpStorm 2020.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.