{"id":19245,"library":"babel-plugin-webpack-alias-7","title":"babel-plugin-webpack-alias-7","description":"Babel 7 plugin that resolves webpack resolve aliases during Babel transpilation. Version 0.1.1, last updated in 2019, with no recent releases. It replaces require paths defined in webpack alias configuration, useful for unit testing environments where webpack is not used. Compared to the original Babel 6 version, it uses a simpler config option without lodash templates. The package is in early development and seeking feedback.","status":"maintenance","version":"0.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/shortminds/babel-plugin-webpack-alias-7","tags":["javascript","babel","webpack","alias"],"install":[{"cmd":"npm install babel-plugin-webpack-alias-7","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-webpack-alias-7","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-webpack-alias-7","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for Babel plugin functionality","package":"@babel/core","optional":false}],"imports":[{"note":"This is a Babel plugin, not a JavaScript module. It is configured via .babelrc or babel.config.js, not imported directly.","wrong":"import babelPluginWebpackAlias7 from 'babel-plugin-webpack-alias-7'","symbol":"default","correct":"// No import needed; add to .babelrc plugins array as 'babel-plugin-webpack-alias-7'"},{"note":"Do not use the Babel 6 version of the plugin name. Use 'babel-plugin-webpack-alias-7' with options object.","wrong":"plugins: [ 'babel-plugin-webpack-alias' ]","symbol":"N/A (plugin usage)","correct":"plugins: [ ['babel-plugin-webpack-alias-7', { config: './webpack.config.js' }] ]"},{"note":"CommonJS require works in Node.js for Babel config files. Ensure correct package name.","wrong":"require('babel-plugin-webpack-alias')","symbol":"N/A (CommonJS)","correct":"require('babel-plugin-webpack-alias-7')"}],"quickstart":{"code":"// .babelrc\n{\n  \"plugins\": [\n    [\"babel-plugin-webpack-alias-7\", { \"config\": \"./webpack.config.js\" }]\n  ]\n}\n\n// webpack.config.js\nvar path = require('path');\nmodule.exports = {\n  resolve: {\n    alias: {\n      '@libs': path.join(__dirname, '/myLibs/')\n    }\n  }\n};\n\n// source.js\nconst myLib = require('@libs/myLib');\n// transpiles to:\nconst myLib = require('/myLibs/myLib');","lang":"javascript","description":"Shows how to configure the plugin and use webpack aliases in Babel."},"warnings":[{"fix":"Review the readme for changes; consider using the original Babel 6 plugin if more features are needed.","message":"Plugin is in early development and may have limited functionality compared to the Babel 6 version.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure a webpack config file exists or provide the config option explicitly.","message":"The plugin requires a webpack config file; if not specified, it looks for webpack.config.js or webpack.config.babel.js in the root.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Do not rely on these options; they are not available in this version.","message":"The 'findConfig' and 'noOutputExtension' options have been removed without replacement.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Remove lodash templates from the config path; use a static string path.","message":"The config option no longer uses lodash templates, which may break configurations relying on that behavior.","severity":"breaking","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev babel-plugin-webpack-alias-7' and ensure the package name is correct in .babelrc","cause":"Plugin not installed or package name misspelled","error":"Error: Could not find plugin 'babel-plugin-webpack-alias-7'"},{"fix":"Run 'npm install --save-dev webpack' or ensure webpack is a dependency","cause":"webpack is not installed, but the plugin requires it to parse the webpack config","error":"Error: Cannot find module 'webpack'"},{"fix":"Remove 'findConfig' option; see documentation for current options","cause":"Using option from Babel 6 version that was removed in this plugin","error":"Error: The 'findConfig' option is not supported"},{"fix":"Use import.meta.url and fileURLToPath to get equivalent of __dirname","cause":"Using ES modules and __dirname is not available in ESM context","error":"ReferenceError: __dirname is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}