zenato / sbt-babel Goto Github PK
View Code? Open in Web Editor NEWAn SBT plugin to perform Babel compilation.
License: MIT License
An SBT plugin to perform Babel compilation.
License: MIT License
Could you publish v1.1.2 for scala 2.12 as well?
Can have an update from 'babel-core' to '@babel/core'
Kindly let me know how in can help though am not well conversant with scala.
Hi there
I am working in a Windows10 environment and unfortunately, this plugin doesn't seem to work :-/
When try to create the assets using play, I get the following error:
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Babel compiling on 4 source(s)
[error] module.js:338
[error] throw err;
[error] ^
[error] Error: Cannot find module 'babel-core'
[error] at Function.Module._resolveFilename (module.js:336:15)
[error] at Function.Module._load (module.js:278:25)
[error] at Module.require (module.js:365:17)
[error] at require (module.js:384:17)
[error] at Object. (C:\Projekte\Privat\betterdating\htdocs\project\target\babel\sbt-babel-1.0.1.jar:8:9)
[error] at Module._compile (module.js:460:26)
[error] at Object.Module._extensions..js (module.js:478:10)
[error] at Module.load (module.js:355:32)
[error] at Function.Module._load (module.js:310:12)
[error] at Function.Module.runMain (module.js:501:10)
[error] module.js:338
[error] throw err;
Of course one would think that the problem is that the babel-core npm module isn't installed, but it actually is:
When I type "npm list -g babel-core" in a terminal, I get the following result:
C:\Users\sam\AppData\Roaming\npm
└── [email protected]
Are there any known issues?
Best regards
Samuel
Hello,
when I add the dependency
addSbtPlugin("io.teamscala.sbt" % "sbt-babel" % "1.0.2")
to the plugins.sbt
of my Play Framework app, the whole SBT project becomes unloadable, failing with the following message:
[info] Resolving com.typesafe#jstranspiler;1.0.0 ...
[warn] module not found: com.typesafe#jstranspiler;1.0.0
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe/jstranspiler/1.0.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe/jstranspiler/1.0.0/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/xwinus/.ivy2/local/com.typesafe/jstranspiler/1.0.0/ivys/ivy.xml
[warn] ==== jcenter: tried
[warn] https://jcenter.bintray.com/com/typesafe/jstranspiler/1.0.0/jstranspiler-1.0.0.pom
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/jstranspiler/1.0.0/jstranspiler-1.0.0.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe#jstranspiler;1.0.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
....
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe#jstranspiler;1.0.0: not found
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
I noticed this dependency is available via the Typesafe Maven Releases Repository (https://repo.typesafe.com/typesafe/maven-releases/), isn't the following repository declaration:
resolvers += "Typesafe Releases Repository" at "https://repo.typesafe.com/typesafe/maven-releases/"
missing in your build.sb
file?
EDIT1: I noticed you have the
resolvers += Resolver.typesafeRepo("releases"),
definition present, which should allow SBT to resolve the correct repository, but unfortunately it is not working for me.
Tested on SBT 0.13.8, Scala 2.11.6
Thanks
It would be nice if node wouldn't be a dependency. Could the plugin be made to use Trireme or Rhino instead? What would be necessary changes for that?
Hi,
Am using this plugin to compile my react modules to umd module but my imports are not resolving.
This is the error i get in the case below.
Uncaught TypeError: Cannot read property 'Component' of undefined
Here is my .babelrc
{
"presets": ["es2015", "stage-0", "react"],
"plugins": ["transform-es2015-modules-umd", "transform-react-jsx"]
}
Here is my module
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import {Button, Checkbox, Form} from 'semantic-ui-react';
export default class Login extends React.Component {
render () {
return (
<div className="ui middle aligned center aligned grid">
<div className="column">
<h2 className="ui image header">
Login
</h2>
</div>
</div>
);
}
}
ReactDOM.render(<Login/>, document.getElementById('content'));
------
Here is the compiled code
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['exports', 'react', 'react-dom', 'semantic-ui-react'], factory);
} else if (typeof exports !== "undefined") {
factory(exports, require('react'), require('react-dom'), require('semantic-ui-react'));
} else {
var mod = {
exports: {}
};
factory(mod.exports, global.react, global.reactDom, global.semanticUiReact);
global.login = mod.exports;
}
})(this, function (exports, _react, _reactDom, _semanticUiReact) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react2 = _interopRequireDefault(_react);
var _reactDom2 = _interopRequireDefault(_reactDom);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Login = function (_React$Component) {
_inherits(Login, _React$Component);
function Login() {
_classCallCheck(this, Login);
return _possibleConstructorReturn(this, (Login.__proto__ || Object.getPrototypeOf(Login)).apply(this, arguments));
}
_createClass(Login, [{
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
{ className: 'ui middle aligned center aligned grid' },
_react2.default.createElement(
'div',
{ className: 'column' },
_react2.default.createElement(
'h2',
{ className: 'ui image header' },
'Login'
)
)
);
}
}]);
return Login;
}(_react2.default.Component);
exports.default = Login;
_reactDom2.default.render(_react2.default.createElement(Login, null), document.getElementById('content'));
});
How can I use it in this pipeline?
pipelineStages := Seq(rjs, gzip)
Also, where should I declare any input for the plugin?
lazy val root = (project in file(".")).enablePlugins(SbtWeb) - is this the target folder declaration?
Is it possible to use this plugin with other SbtWeb plugins? My requirejs build fails because this plugin has not run yet (I use pipelineStages := Seq(rjs, digest, gzip)
). Can I somehow include this plugin into the pipeline?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.