Last active
September 5, 2022 05:19
-
-
Save jaceju/1d450923eaa550c42289dc39db669e61 to your computer and use it in GitHub Desktop.
Webpack resolve alias in PhpStorm/WebStorm
This file contains 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
// @see https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000556284-vue-import-component-Module-is-not-installed-?page=2#community_comment_360000146344 | |
// If you use vue-cli 3: | |
// Put this file to root folder fo the project | |
// Open PhpStorm or WebStorm, and goto | |
// Perferences / Languages & Frameworks / JavaScript / Webpack | |
// webpack configuration file: </path/to/project/node_modules/@vue/cli-service/webpack.config.js> | |
const path = require("path"); | |
function resolve(dir) { | |
return path.join(__dirname, dir); | |
} | |
module.exports = { | |
lintOnSave: true, | |
chainWebpack: config => { | |
config.resolve.alias.set("@tests", resolve("tests")); | |
} | |
}; |
This file contains 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
// @see https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000556284-vue-import-component-Module-is-not-installed-?page=2#community_comment_360000146344 | |
// Put this file to root folder fo the project | |
// Open PhpStorm or WebStorm, and goto | |
// Perferences / Languages & Frameworks / JavaScript / Webpack | |
// webpack configuration file: </path/to/this/file> | |
const path = require("path"); | |
const webpackConfig = require("./node_modules/@vue/cli-service/webpack.config"); | |
Object.assign(webpackConfig.resolve.alias, { | |
"@tests": path.resolve(__dirname, "./tests") | |
}); | |
module.exports = webpackConfig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment