{"id":19505918,"url":"https://github.com/morlay/babel-plugin-webpack-loaders-inline-exports","last_synced_at":"2026-06-07T20:31:49.652Z","repository":{"id":69524073,"uuid":"52155996","full_name":"morlay/babel-plugin-webpack-loaders-inline-exports","owner":"morlay","description":null,"archived":false,"fork":false,"pushed_at":"2016-12-30T09:35:17.000Z","size":68,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-03T09:18:06.385Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morlay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-20T14:00:21.000Z","updated_at":"2017-03-13T06:32:40.000Z","dependencies_parsed_at":"2023-04-10T09:20:19.828Z","dependency_job_id":null,"html_url":"https://github.com/morlay/babel-plugin-webpack-loaders-inline-exports","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"82d1a9a7b3ef9294129d6e89670125a4535b17f0"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Fbabel-plugin-webpack-loaders-inline-exports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Fbabel-plugin-webpack-loaders-inline-exports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Fbabel-plugin-webpack-loaders-inline-exports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Fbabel-plugin-webpack-loaders-inline-exports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morlay","download_url":"https://codeload.github.com/morlay/babel-plugin-webpack-loaders-inline-exports/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240754364,"owners_count":19852189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T22:34:55.244Z","updated_at":"2026-06-07T20:31:48.998Z","avatar_url":"https://github.com/morlay.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## babel-plugin-webpack-loaders-inline-exports\n\nMake webpack-loaders inline exports \n\n[![Build Status](https://img.shields.io/travis/morlay/babel-plugin-webpack-loaders-inline-exports.svg?style=flat-square)](https://travis-ci.org/morlay/babel-plugin-webpack-loaders-inline-exports)\n[![NPM](https://img.shields.io/npm/v/babel-plugin-webpack-loaders-inline-exports.svg?style=flat-square)](https://npmjs.org/package/babel-plugin-webpack-loaders-inline-exports)\n[![Dependencies](https://img.shields.io/david/morlay/babel-plugin-webpack-loaders-inline-exports.svg?style=flat-square)](https://david-dm.org/morlay/babel-plugin-webpack-loaders-inline-exports)\n[![License](https://img.shields.io/npm/l/babel-plugin-webpack-loaders-inline-exports.svg?style=flat-square)](https://npmjs.org/package/babel-plugin-webpack-loaders-inline-exports)\n\n\n[webpack-loaders](https://github.com/istarkov/babel-plugin-webpack-loaders) is cool, \nbut it did some transforms from loader compiled result.\n\nFor each matched loader, they could transform as a commonjs module\n \n```js\nmodule.exports = webpackBootstrap([\n  function (module, exports, __webpack_require__){\n    module.exports = __webpack_require__.p + 'xxsdfasdasd.txt';\n  }\n])\n```\nand we can just pick the webpackResult as inline exports\n\n```js\nconst txt = require('./some.txt');\n```\nwill be \n```js\nconst txt = webpackBootstrap([\n  function (module, exports, __webpack_require__){\n    module.exports = __webpack_require__.p + 'xxsdfasdasd.txt';\n  }\n]);\n```\n\nAnd for some loader, they may exports with other dependences, but it will works well.\nin this plugin, webpackConfig will be overwrite by the special config below: \n\n```js\n{\n  entry: filename,\n  output: {      \n    libraryTarget: 'commonjs2',\n  },\n  externals: [      \n    (context, subRequest, callback) =\u003e {\n      if (subRequest !== filename) {\n        callback(null, subRequest);\n      } else {\n          callback();\n      }\n    }\n  ]\n}\n```\nTo make sure only process the target file which is matched by loader.\n\n## Options\n\nall options same as webpack, and we can assign a config by the webpack config file\n\n```json\n{\n  \"plugins\": [\n    [\n       \"babel-plugin-webpack-loaders-inline-exports\",\n       {\n          \"configFile\": \"./webpack.config.js\"\n       }\n    ]\n  ]\n}\n```\nspecial options in babel option for this plugin will merge into webpack config.\n\nFor `ava` user, add set env var `$PWD` is needed;\n\n```json\n{\n  \"plugins\": [\n    [\n       \"babel-plugin-webpack-loaders-inline-exports\",\n       {\n          \"configFile\": \"${PWD}/webpack.config.js\"\n       }\n    ]\n  ]\n}\n```\n\n### Warning\n\n* Please use this only in Node.\n* And for `css-loader`, should use with `extract-text-webpack-plugin` and don't use with `style-loader`\n* `BABEL_DISABLE_CACHE=1` may used","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorlay%2Fbabel-plugin-webpack-loaders-inline-exports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorlay%2Fbabel-plugin-webpack-loaders-inline-exports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorlay%2Fbabel-plugin-webpack-loaders-inline-exports/lists"}