@sucrase/webpack-loader
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -1,10 +0,11 @@ | ||
"use strict"; | ||
const loader_utils_1 = require("loader-utils"); | ||
const sucrase_1 = require("sucrase"); | ||
"use strict"; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _loaderutils = require('loader-utils'); | ||
var _sucrase = require('sucrase'); | ||
function loader(code) { | ||
const webpackRemainingChain = loader_utils_1.getRemainingRequest(this).split("!"); | ||
const filePath = webpackRemainingChain[webpackRemainingChain.length - 1]; | ||
const options = loader_utils_1.getOptions(this); | ||
return sucrase_1.transform(code, Object.assign({ filePath }, options)); | ||
const webpackRemainingChain = (0, _loaderutils.getRemainingRequest)(this).split("!"); | ||
const filePath = webpackRemainingChain[webpackRemainingChain.length - 1]; | ||
const options = (0, _loaderutils.getOptions)(this) ; | ||
return (0, _sucrase.transform)(code, {filePath, ...options}).code; | ||
} | ||
module.exports = loader; |
{ | ||
"name": "@sucrase/webpack-loader", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Webpack loader for Sucrase", | ||
@@ -10,7 +10,7 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"sucrase": "^1.12.1" | ||
"sucrase": "^3" | ||
}, | ||
"devDependencies": { | ||
"@types/loader-utils": "^1.1.1", | ||
"sucrase": "^1.12.1" | ||
"sucrase": "^3.0.0" | ||
}, | ||
@@ -17,0 +17,0 @@ "dependencies": { |
@@ -9,7 +9,6 @@ # Sucrase Webpack loader | ||
**Note: Sucrase does not transform object rest/spread syntax (e.g. | ||
`{...a, b: c}`), and the syntax is not yet supported by Webpack. If you use that | ||
syntax, you should use the | ||
**Note: Object rest/spread syntax (e.g. `{...a, b: c}`) requires Webpack 4. For | ||
earlier Webpack versions, you can use | ||
[webpack-object-rest-spread-plugin](https://github.com/alangpierce/sucrase/tree/master/integrations/webpack-object-rest-spread-plugin) | ||
package alongside this loader, and add both to your webpack config.** | ||
alongside this loader.** | ||
@@ -16,0 +15,0 @@ ## Usage |
@@ -8,5 +8,5 @@ import {getOptions, getRemainingRequest} from "loader-utils"; | ||
const options: Options = getOptions(this) as Options; | ||
return transform(code, {filePath, ...options}); | ||
return transform(code, {filePath, ...options}).code; | ||
} | ||
export = loader; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7291
8
47
37