Add browser versions of the transform files.
This commit is contained in:
@@ -22,7 +22,9 @@
|
||||
"compiler"
|
||||
],
|
||||
"browser": {
|
||||
"./lib/config/loading/files/index.js": "./lib/config/loading/files/index-browser.js"
|
||||
"./lib/config/loading/files/index.js": "./lib/config/loading/files/index-browser.js",
|
||||
"./lib/transform-file.js": "./lib/transform-file-browser.js",
|
||||
"./lib/transform-file-sync.js": "./lib/transform-file-sync-browser.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-code-frame": "7.0.0-beta.2",
|
||||
|
||||
14
packages/babel-core/src/transform-file-browser.js
Normal file
14
packages/babel-core/src/transform-file-browser.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// @flow
|
||||
import type { FileResult } from "./transformation";
|
||||
|
||||
export default function transformFile(
|
||||
filename: string,
|
||||
opts?: Object = {},
|
||||
callback: (?Error, FileResult | null) => void,
|
||||
) {
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
}
|
||||
|
||||
callback(new Error("Transforming files is not supported in browsers"), null);
|
||||
}
|
||||
5
packages/babel-core/src/transform-file-sync-browser.js
Normal file
5
packages/babel-core/src/transform-file-sync-browser.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// @flow
|
||||
|
||||
export default function transformFileSync() {
|
||||
throw new Error("Transforming files is not supported in browsers");
|
||||
}
|
||||
Reference in New Issue
Block a user