{"_id":"af-babel-loader","_rev":"2856138","name":"af-babel-loader","description":"babel module loader for webpack","dist-tags":{"latest":"7.1.3"},"maintainers":[{"name":"sorrycc","email":""}],"time":{"modified":"2022-09-06T16:44:48.000Z","created":"2017-10-23T09:58:08.268Z","7.1.3":"2017-10-23T10:28:14.012Z","7.1.2":"2017-10-23T09:58:08.268Z"},"users":{},"author":{"name":"Luis Couto","email":"hello@luiscouto.pt"},"repository":{"type":"git","url":"git+https://github.com/babel/babel-loader.git"},"versions":{"7.1.3":{"name":"af-babel-loader","version":"7.1.3","description":"babel module loader for webpack","files":["lib"],"main":"lib/index.js","engines":{"node":">=4"},"dependencies":{"find-cache-dir":"^1.0.0","loader-utils":"^1.0.2","mkdirp":"^0.5.1","babel-core":"^7.0.0-beta.2"},"devDependencies":{"ava":"^0.22.0","babel-cli":"^6.18.0","babel-core":"^6.0.0","babel-eslint":"^8.0.0","babel-plugin-istanbul":"^4.0.0","babel-plugin-react-intl":"^2.1.3","babel-preset-env":"^1.2.0","babel-register":"^6.18.0","cross-env":"^5.0.0","eslint":"^4.1.0","eslint-config-babel":"^7.0.0","eslint-plugin-flowtype":"^2.25.0","eslint-plugin-prettier":"^2.1.2","husky":"^0.14.0","lint-staged":"^4.0.0","nyc":"^11.0.1","prettier":"^1.2.2","react":"^16.0.0","react-intl":"^2.1.2","react-intl-webpack-plugin":"^0.0.3","rimraf":"^2.4.3","webpack":"^3.0.0"},"scripts":{"clean":"rimraf lib/","build":"babel src/ --out-dir lib/","format":"prettier --write --trailing-comma all \"src/**/*.js\" \"test/**/*.test.js\" \"test/helpers/*.js\" && prettier --write --trailing-comma es5 \"scripts/*.js\"","lint":"eslint src test","preversion":"yarn run test","test":"yarn run lint && cross-env BABEL_ENV=test yarn run build && yarn run test-only","test-only":"nyc ava"},"repository":{"type":"git","url":"git+https://github.com/babel/babel-loader.git"},"keywords":["webpack","loader","babel","es6","transpiler","module"],"author":{"name":"Luis Couto","email":"hello@luiscouto.pt"},"license":"MIT","bugs":{"url":"https://github.com/babel/babel-loader/issues"},"homepage":"https://github.com/babel/babel-loader","nyc":{"all":true,"include":["src/**/*.js"],"reporter":["text","json"],"require":["babel-register"],"sourceMap":false,"instrument":false},"ava":{"files":["test/**/*.test.js","!test/fixtures/**/*","!test/helpers/**/*"],"source":["src/**/*.js"],"babel":"inherit"},"lint-staged":{"scripts/*.js":["prettier --trailing-comma es5 --write","git add"],"src/**/*.js":["prettier --trailing-comma all --write","git add"],"test/**/*.test.js":["prettier --trailing-comma all --write","git add"],"test/helpers/*.js":["prettier --trailing-comma all --write","git add"],"package.json":["node ./scripts/yarn-install.js","git add yarn.lock"]},"gitHead":"f2368ffe576159c4332c498d0330dfaed80bf06e","_id":"af-babel-loader@7.1.3","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"sorrycc","email":"sorrycc@gmail.com"},"dist":{"shasum":"07f7492f88ce6899ddbdc1de0bc2ccb38ae476ac","size":9786,"noattachment":false,"key":"/af-babel-loader/-/af-babel-loader-7.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/af-babel-loader/download/af-babel-loader-7.1.3.tgz"},"maintainers":[{"name":"sorrycc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/af-babel-loader-7.1.3.tgz_1508754493870_0.2200802171137184"},"directories":{},"_cnpmcore_publish_time":"2021-12-20T08:08:24.527Z","publish_time":1508754494012,"_cnpm_publish_time":1508754494012},"7.1.2":{"name":"af-babel-loader","version":"7.1.2","description":"babel module loader for webpack","files":["lib"],"main":"lib/index.js","engines":{"node":">=4"},"dependencies":{"find-cache-dir":"^1.0.0","loader-utils":"^1.0.2","mkdirp":"^0.5.1"},"peerDependencies":{"babel-core":"6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc","webpack":"2 || 3"},"devDependencies":{"ava":"^0.22.0","babel-cli":"^6.18.0","babel-core":"^6.0.0","babel-eslint":"^8.0.0","babel-plugin-istanbul":"^4.0.0","babel-plugin-react-intl":"^2.1.3","babel-preset-env":"^1.2.0","babel-register":"^6.18.0","cross-env":"^5.0.0","eslint":"^4.1.0","eslint-config-babel":"^7.0.0","eslint-plugin-flowtype":"^2.25.0","eslint-plugin-prettier":"^2.1.2","husky":"^0.14.0","lint-staged":"^4.0.0","nyc":"^11.0.1","prettier":"^1.2.2","react":"^16.0.0","react-intl":"^2.1.2","react-intl-webpack-plugin":"^0.0.3","rimraf":"^2.4.3","webpack":"^3.0.0"},"scripts":{"clean":"rimraf lib/","build":"babel src/ --out-dir lib/","format":"prettier --write --trailing-comma all \"src/**/*.js\" \"test/**/*.test.js\" \"test/helpers/*.js\" && prettier --write --trailing-comma es5 \"scripts/*.js\"","lint":"eslint src test","precommit":"lint-staged","prepublish":"yarn run clean && yarn run build","preversion":"yarn run test","test":"yarn run lint && cross-env BABEL_ENV=test yarn run build && yarn run test-only","test-only":"nyc ava"},"repository":{"type":"git","url":"git+https://github.com/babel/babel-loader.git"},"keywords":["webpack","loader","babel","es6","transpiler","module"],"author":{"name":"Luis Couto","email":"hello@luiscouto.pt"},"license":"MIT","bugs":{"url":"https://github.com/babel/babel-loader/issues"},"homepage":"https://github.com/babel/babel-loader","nyc":{"all":true,"include":["src/**/*.js"],"reporter":["text","json"],"require":["babel-register"],"sourceMap":false,"instrument":false},"ava":{"files":["test/**/*.test.js","!test/fixtures/**/*","!test/helpers/**/*"],"source":["src/**/*.js"],"babel":"inherit"},"lint-staged":{"scripts/*.js":["prettier --trailing-comma es5 --write","git add"],"src/**/*.js":["prettier --trailing-comma all --write","git add"],"test/**/*.test.js":["prettier --trailing-comma all --write","git add"],"test/helpers/*.js":["prettier --trailing-comma all --write","git add"],"package.json":["node ./scripts/yarn-install.js","git add yarn.lock"]},"gitHead":"f6a05705274b45caa61e96983a41514fe6fb161b","_id":"af-babel-loader@7.1.2","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"sorrycc","email":"sorrycc@gmail.com"},"dist":{"shasum":"43d4fedc8bc0c439a1fdccfc031ceec637546a88","size":9835,"noattachment":false,"key":"/af-babel-loader/-/af-babel-loader-7.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/af-babel-loader/download/af-babel-loader-7.1.2.tgz"},"maintainers":[{"name":"sorrycc","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/af-babel-loader-7.1.2.tgz_1508752688165_0.008740774588659406"},"directories":{},"_cnpmcore_publish_time":"2021-12-20T08:08:23.627Z","publish_time":1508752688268,"_cnpm_publish_time":1508752688268}},"readme":"[![NPM Status](https://img.shields.io/npm/v/babel-loader.svg?style=flat)](https://www.npmjs.com/package/babel-loader)\n[![Build Status](https://travis-ci.org/babel/babel-loader.svg?branch=master)](https://travis-ci.org/babel/babel-loader)\n[![Build Status](https://ci.appveyor.com/api/projects/status/vgtpr2i5bykgyuqo/branch/master?svg=true)](https://ci.appveyor.com/project/danez/babel-loader/branch/master)\n[![codecov](https://codecov.io/gh/babel/babel-loader/branch/master/graph/badge.svg)](https://codecov.io/gh/babel/babel-loader)\n\n<div align=\"center\">\n  <a href=\"https://github.com/babel/babel/\">\n    <img width=\"200\" height=\"200\" src=\"https://rawgit.com/babel/logo/master/babel.svg\">\n  </a>\n  <a href=\"https://github.com/webpack/webpack\">\n    <img width=\"200\" height=\"200\" src=\"https://webpack.js.org/assets/icon-square-big.svg\">\n  </a>\n  <h1>Babel Loader</h1>\n</div>\n\nThis package allows transpiling JavaScript files using [Babel](https://github.com/babel/babel) and [webpack](https://github.com/webpack/webpack).\n\n__Notes:__ Issues with the output should be reported on the babel [issue tracker](https://github.com/babel/babel/issues).\n\n<h2 align=\"center\">Install</h2>\n\n> webpack 1.x | babel-loader <= 6.x\n>\n> webpack 2.x | babel-loader >= 7.x (recommended) (^6.2.10 will also work, but with deprecation warnings)\n>\n> webpack 3.x | babel-loader >= 7.1\n\n```bash\nyarn add babel-loader babel-core babel-preset-env webpack --dev\n```\n\nWe recommend using yarn, but you can also still use npm:\n\n```bash\nnpm install --save-dev babel-loader babel-core babel-preset-env webpack\n```\n\n<h2 align=\"center\">Usage</h2>\n\n[Documentation: Using loaders](https://webpack.js.org/loaders/)\n\nWithin your webpack configuration object, you'll need to add the babel-loader to the list of modules, like so:\n\n```javascript\nmodule: {\n  rules: [\n    {\n      test: /\\.js$/,\n      exclude: /(node_modules|bower_components)/,\n      use: {\n        loader: 'babel-loader',\n        options: {\n          presets: ['env']\n        }\n      }\n    }\n  ]\n}\n```\n\n### Options\n\nSee the `babel` [options](https://babeljs.io/docs/usage/api/#options).\n\n\nYou can pass options to the loader by using the [options property](https://webpack.js.org/configuration/module/#rule-options-rule-query):\n\n```javascript\nmodule: {\n  rules: [\n    {\n      test: /\\.js$/,\n      exclude: /(node_modules|bower_components)/,\n      use: {\n        loader: 'babel-loader',\n        options: {\n          presets: ['env'],\n          plugins: [require('babel-plugin-transform-object-rest-spread')]\n        }\n      }\n    }\n  ]\n}\n```\n\nThis loader also supports the following loader-specific option:\n\n* `cacheDirectory`: Default `false`. When set, the given directory will be used to cache the results of the loader. Future webpack builds will attempt to read from the cache to avoid needing to run the potentially expensive Babel recompilation process on each run. If the value is blank (`loader: 'babel-loader?cacheDirectory'`) or `true` (`loader: babel-loader?cacheDirectory=true`) the loader will use the default cache directory in `node_modules/.cache/babel-loader` or fallback to the default OS temporary file directory if no `node_modules` folder could be found in any root directory.\n\n* `cacheIdentifier`: Default is a string composed by the babel-core's version, the babel-loader's version, the contents of .babelrc file if it exists and the value of the environment variable `BABEL_ENV` with a fallback to the `NODE_ENV` environment variable. This can be set to a custom value to force cache busting if the identifier changes.\n\n* `forceEnv`: Default will resolve BABEL_ENV then NODE_ENV. Allow you to override BABEL_ENV/NODE_ENV at the loader level. Useful for isomorphic applications with different babel configuration for client and server.\n\n__Note:__ The `sourceMap` option is ignored, instead sourceMaps are automatically enabled when webpack is configured to use them (via the `devtool` config option).\n\n## Troubleshooting\n\n### babel-loader is slow!\n\nMake sure you are transforming as few files as possible. Because you are probably\nmatching `/\\.js$/`, you might be transforming the `node_modules` folder or other unwanted\nsource.\n\nTo exclude `node_modules`, see the `exclude` option in the `loaders` config as documented above.\n\nYou can also speed up babel-loader by as much as 2x by using the `cacheDirectory` option.\nThis will cache transformations to the filesystem.\n\n### babel is injecting helpers into each file and bloating my code!\n\nbabel uses very small helpers for common functions such as `_extend`. By default\nthis will be added to every file that requires it.\n\nYou can instead require the babel runtime as a separate module to avoid the duplication.\n\nThe following configuration disables automatic per-file runtime injection in babel, instead\nrequiring `babel-plugin-transform-runtime` and making all helper references use it.\n\nSee the [docs](http://babeljs.io/docs/plugins/transform-runtime/) for more information.\n\n**NOTE:** You must run `npm install babel-plugin-transform-runtime --save-dev` to include this in your project and `babel-runtime` itself as a dependency with `npm install babel-runtime --save`.\n\n```javascript\nrules: [\n  // the 'transform-runtime' plugin tells babel to require the runtime\n  // instead of inlining it.\n  {\n    test: /\\.js$/,\n    exclude: /(node_modules|bower_components)/,\n    use: {\n      loader: 'babel-loader',\n      options: {\n        presets: ['env'],\n        plugins: ['transform-runtime']\n      }\n    }\n  }\n]\n```\n\n#### **NOTE:** transform-runtime & custom polyfills (e.g. Promise library)\n\nSince [babel-plugin-transform-runtime](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime) includes a polyfill that includes a custom [regenerator runtime](https://github.com/facebook/regenerator/blob/master/packages/regenerator-runtime/runtime.js) and [core.js](https://github.com/zloirock/core-js), the following usual shimming method using `webpack.ProvidePlugin` will not work:\n\n```javascript\n// ...\n        new webpack.ProvidePlugin({\n            'Promise': 'bluebird'\n        }),\n// ...\n```\n\nThe following approach will not work either:\n\n```javascript\nrequire('babel-runtime/core-js/promise').default = require('bluebird');\n\nvar promise = new Promise;\n```\n\nwhich outputs to (using `runtime`):\n\n```javascript\n'use strict';\n\nvar _Promise = require('babel-runtime/core-js/promise')['default'];\n\nrequire('babel-runtime/core-js/promise')['default'] = require('bluebird');\n\nvar promise = new _Promise();\n```\n\nThe previous `Promise` library is referenced and used before it is overridden.\n\nOne approach is to have a \"bootstrap\" step in your application that would first override the default globals before your application:\n\n```javascript\n// bootstrap.js\n\nrequire('babel-runtime/core-js/promise').default = require('bluebird');\n\n// ...\n\nrequire('./app');\n```\n\n### The node API for `babel` has been moved to `babel-core`.\n\nIf you receive this message it means that you have the npm package `babel` installed and use the short notation of the loader in the webpack config (which is not valid anymore as of webpack 2.x):\n```js\n  {\n    test: /\\.js$/,\n    loader: 'babel',\n  }\n```\n\nWebpack then tries to load the `babel` package instead of the `babel-loader`.\n\nTo fix this you should uninstall the npm package `babel` as it is deprecated in babel v6. (instead install `babel-cli` or `babel-core`)\nIn the case one of your dependencies is installing `babel` and you cannot uninstall it yourself, use the complete name of the loader in the webpack config:\n```js\n  {\n    test: /\\.js$/,\n    loader: 'babel-loader',\n  }\n```\n\n## [License](http://couto.mit-license.org/)\n","_attachments":{},"homepage":"https://github.com/babel/babel-loader","bugs":{"url":"https://github.com/babel/babel-loader/issues"},"license":"MIT"}