babel

ReactJS linting (eslint) and transpiling (babel) error on shared code using monorepo (Lerna + Yarn Workspaces)

徘徊边缘 提交于 2019-12-25 00:22:48
问题 I´m building a monorepo using yarn workspaces, lerna and 2 different projects: ux - a React component library built using create-react-app auth - a React application that uses ux library built using create-react-app and then ejected (the ejection was done to try to solve the current linting and transpiling error). My monorepo setup is: project |-------- node_modules |-------- lerna.json |-------- package.json |-------- packages |----------- auth |------- node_modules |------- src |-------

Efficiently find duplicate data property in object literal?

倖福魔咒の 提交于 2019-12-24 23:57:43
问题 After creating our new system in Vue with babel, I have started testing compatibility towards older devices. Our babel is transpiling the source down to es2015 together with webpack. I have now tested with browserstack against both Ios & android. Newer OS works on both platforms. However on android phones that use the default browser, I get an error in sentry stating; Duplicate data property in object literal not allowed in strict mode It does not give me any hints on where this might be thus

Promise returns with 'undefined' or babel compiled code doesn't wait for return (async/await)

。_饼干妹妹 提交于 2019-12-24 19:24:09
问题 There is an async function ( send ) in which if the msg attribute is not defined, another function ( getNextProcess ) sets its value. getNextProcess performs a database query within a Promise. The query callback the Promise resolve function. Problem: After translating the code with Babel, msg will always be 'undefined'. Promise runs in the background independently and returns with the correct value (checked with console log). /* ORIGINAL */ class MyClass(){ /* construct & other codes here...

How to include a few node_modules package in babel-node

那年仲夏 提交于 2019-12-24 18:55:58
问题 I'm trying to include @mycompany/package1, and @mycompany/package2 to be compiled along with the rest of my code using babel-node . Since package1 and package2 are in ES6. (Also note I'm not using Webpack) In my jest config I added the below option into my jest config which works fine. When testing the code will compile the packages correctly "transformIgnorePatterns": [ "/node_modules/(?!(@mycompany)/).*/" ], But when trying to run babel-node I get errors. In my babel.config.js module

How to get custom React Babel pragma to pass string as argument rather than function

梦想与她 提交于 2019-12-24 18:46:05
问题 As a follow up to How to create your own babel processor alternative to `React`, I am getting this error: react-dom.development.js:506 Warning: The tag is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter. in foo in Unknown in Bar If I make it a capital letter, then this error: Uncaught ReferenceError: Foo is not defined I'm guessing this is because it's passing it as a function like this: React.createElement(Foo) My question is,

Reactjs console errors: 'Components object is deprectated' & 'ReferenceError: require is not defined'

房东的猫 提交于 2019-12-24 18:40:30
问题 I'm trying to use jsx with classes create a simple hello world program to print 'Hello world' in my browser(firefox). I can get a single page [html with embedded jsx][1] to work. But not when I try to use classes. I am receiving the following in my console output Download the React DevTools for a better development experience: https://fb .me/react-devtools You might need to use a local HTTP server (instead of file://): https://fb .me/react-devtools-faq react-dom.development.js:21347:9

node.js async await - error regeneratorRuntime

久未见 提交于 2019-12-24 18:36:51
问题 I learnt how to use promises in a browser but when I want to use it in my node.js it throw error. var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url) { ^ ReferenceError: regeneratorRuntime is not defined node version v10.4.1 I use babel for export and import syntax with settings like here in starting file require('babel-register')({ presets: [ 'env' ] }) 回答1: babel-polyfill is required. You must also install it in order to get async/await working. Here

How to import a jQuery plugin into a babel app

雨燕双飞 提交于 2019-12-24 18:23:04
问题 So I have a modern javascript app build using ES6 modules and transpiled by babel. In this app, I need to use a jQuery plugin for some DOM manipulations. I don't want to globally expose jQuery and then load the plugin code into the document using a script tag. Instead, I want the plugin to be available only inside a module: import $ from 'jquery'; // some magic importing pluginName $('#element').pluginName(); // how to make this work? Of course plugin is not a module and it needs the $

Entry module not found: Error: Can't resolve './src'

自古美人都是妖i 提交于 2019-12-24 16:19:05
问题 I am following a tutorial for setting up react with webpack and babel but i am getting errors. I have tried re-installing all modules but it didn't worked. I have also matched my config codes still no luck. ReactJs@1.0.0 create C:\Users\Gourav Thakur\Desktop\Me Creative\github_codebase\ReactJs webpack Insufficient number of arguments or no entry found. Alternatively, run 'webpack(-cli) --help' for usage info. Hash: 854e6cae7eaf01829eca Version: webpack 4.30.0 Time: 82ms Built at: 04/28/2019 2

ant-design-vue组件的三种加载方式

强颜欢笑 提交于 2019-12-24 15:13:36
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 完整引入 main.js 中全局引入并注册 import Antd from 'ant-design-vue' import 'ant-design-vue/dist/antd.css' Vue.use(Antd) 在页面中不再需要引入注册组件,可以直接使用所有的组件 <template> <div> <a-button type="primary">hello world</a-button> </div> </template> <script> export default {} </script> 导入部分组件 在 main.js 中导入并注册需要在项目中使用的组件 import { Button } from "ant-design-vue"; import 'ant-design-vue/lib/button/style/css' Vue.component(Button.name, Button) 在项目中可以直接使用这个已经注册的组件 <template> <div> <a-button type="primary">hello world</a-button> </div> </template> <script> export default {} </script> 按需加载 ant