{"id":24950,"library":"babel-inline-import-loader","title":"babel-inline-import-loader","description":"A webpack loader that integrates with babel-plugin-inline-import to ensure file imports via the plugin trigger webpack rebuilds on content changes. Version 1.0.1 is current, with no recent updates since 2020. Releases are infrequent, focusing on bug fixes. Unlike alternative approaches that require manual watchers, this loader leverages webpack's addDependency API for automatic rebuilds. Requires babel-plugin-inline-import@3.0.0+ and webpack. Primarily used with babel-loader in JavaScript projects.","status":"maintenance","version":"1.0.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/elliottsj/babel-inline-import-loader","tags":["javascript"],"install":[{"cmd":"npm install babel-inline-import-loader","lang":"bash","label":"npm"},{"cmd":"yarn add babel-inline-import-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-inline-import-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for the inline import transformation; loader relies on the comment generated by the plugin.","package":"babel-plugin-inline-import","optional":false}],"imports":[{"note":"This package is a webpack loader, not a JavaScript module. Use require() in webpack config. No default export.","wrong":"import loader from 'babel-inline-import-loader'","symbol":"default","correct":"module.exports = require('babel-inline-import-loader')"}],"quickstart":{"code":"// webpack.config.js\nconst path = require('path');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js'\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        use: [\n          'babel-inline-import-loader',\n          {\n            loader: 'babel-loader',\n            options: {\n              plugins: [\n                ['inline-import', {\n                  extensions: ['.txt']\n                }]\n              ],\n              cacheDirectory: false\n            }\n          }\n        ]\n      }\n    ]\n  }\n};\n// Note: Ensure babel-plugin-inline-import@>=3.0.0 is installed.","lang":"javascript","description":"Demonstrates basic webpack configuration to enable file imports via babel-plugin-inline-import with automatic rebuilds."},"warnings":[{"fix":"Set 'cacheDirectory: false' in babel-loader options.","message":"Must disable babel-loader cacheDirectory (set to false) to ensure rebuilds on inline-import file changes.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade babel-plugin-inline-import to version 3.0.0 or later.","message":"Requires babel-plugin-inline-import@3.0.0 or later for comment generation support.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure use array order: ['babel-inline-import-loader', { loader: 'babel-loader', options: {...} }]","message":"Loader order matters: babel-inline-import-loader must be placed before babel-loader in the use array.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Confirm babel-plugin-inline-import generates the expected comment.","message":"The loader only processes files with the pattern '/* babel-plugin-inline-import '<path>' */' comments; custom plugin versions may not include the comment.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install babel-inline-import-loader --save-dev'","cause":"Loader is not installed or not in node_modules.","error":"Module not found: Error: Can't resolve 'babel-inline-import-loader'"},{"fix":"Use require in webpack config: const loader = require('babel-inline-import-loader');","cause":"Incorrect import (e.g., using ESM import instead of require) or path issue.","error":"Error: The loader 'babel-inline-import-loader' is not a function"},{"fix":"Install babel-plugin-inline-import@>=3.0.0 and add to babel plugins.","cause":"babel-plugin-inline-import not installed or not specified correctly.","error":"babel-plugin-inline-import: Unknown plugin \"inline-import\" specified in ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}