babeljs

Function.prototype.toString issues in IE11 Svelte/Babel/Rollup

回眸只為那壹抹淺笑 提交于 2021-02-08 07:22:00
问题 My current rollup.config.js is commonjs(), babel({ extensions: ['.js', '.mjs', '.html', '.svelte'], runtimeHelpers: true, exclude: ['node_modules/@babel/**', 'node_modules/core-js/**' ], // <= /!\ NOT 'node_mobules/**' presets: [ ['@babel/preset-env', { // adapter to ensure IE 11 support targets: '> 0.25%, not dead, IE 11', "modules": false, "spec": true, "forceAllTransforms": true, useBuiltIns: 'usage', corejs: 3 }] ], plugins: [ '@babel/plugin-syntax-dynamic-import', [ '@babel/plugin

Function.prototype.toString issues in IE11 Svelte/Babel/Rollup

你离开我真会死。 提交于 2021-02-08 07:19:37
问题 My current rollup.config.js is commonjs(), babel({ extensions: ['.js', '.mjs', '.html', '.svelte'], runtimeHelpers: true, exclude: ['node_modules/@babel/**', 'node_modules/core-js/**' ], // <= /!\ NOT 'node_mobules/**' presets: [ ['@babel/preset-env', { // adapter to ensure IE 11 support targets: '> 0.25%, not dead, IE 11', "modules": false, "spec": true, "forceAllTransforms": true, useBuiltIns: 'usage', corejs: 3 }] ], plugins: [ '@babel/plugin-syntax-dynamic-import', [ '@babel/plugin

What determines the order of `require` calls in babel-transpiled scripts?

狂风中的少年 提交于 2021-02-08 05:02:08
问题 So, my workflow up to this point was to put import "babel-polyfill"; when using features like async / await to ask babel to include the regenerator runtime in the transpilation. I see the the following problems for users requiring my module: The user is in an ES2015 environment and transpiles his code with babel-polyfill , too. Since babel-polyfill can only be required once, he will not be able to use my module at all. If I thus choose not to include babel-polyfill , babel doesn't know that

What determines the order of `require` calls in babel-transpiled scripts?

孤街醉人 提交于 2021-02-08 05:01:08
问题 So, my workflow up to this point was to put import "babel-polyfill"; when using features like async / await to ask babel to include the regenerator runtime in the transpilation. I see the the following problems for users requiring my module: The user is in an ES2015 environment and transpiles his code with babel-polyfill , too. Since babel-polyfill can only be required once, he will not be able to use my module at all. If I thus choose not to include babel-polyfill , babel doesn't know that

Transpiling NextJS for IE 10/11; 'Weakset undefined'

余生长醉 提交于 2021-02-07 13:26:59
问题 I have a NextJS website I'm building and it's great, except that it does not work in IE 10/11 because some code is not being transpiled correctly. I'm really bad with babel and webpack, and have never had to config them myself before. I've been trying to solve by reading online for two days now, and nothing seems to work for me. The exact error I get is weakSet is not defined , and it is coming from the common.js file. Here is my .babelrc file, located in the root of my project. // .babelrc {

import * as (jasmine spyOn) not writable

你。 提交于 2021-02-07 11:23:04
问题 After upgrading to babel 7.1.5 my tests fail when i'm using import * as. test.spec.js import * as Helper from "../../../../src/renderer/modules/Helper"; describe('Testing', () => { it('Should import correctly', () => { console.log(Helper.test()) // a spyOn(Helper, 'test').and.returnValue('b'); }); }); Helper.js function test() { return 'a' } export {test} ERROR 'Upgrade.spec.js (7:8)', 'a' Error: <spyOn> : test is not declared writable or has no setter Usage: spyOn(<object>, <methodName>) at

import * as (jasmine spyOn) not writable

て烟熏妆下的殇ゞ 提交于 2021-02-07 11:22:34
问题 After upgrading to babel 7.1.5 my tests fail when i'm using import * as. test.spec.js import * as Helper from "../../../../src/renderer/modules/Helper"; describe('Testing', () => { it('Should import correctly', () => { console.log(Helper.test()) // a spyOn(Helper, 'test').and.returnValue('b'); }); }); Helper.js function test() { return 'a' } export {test} ERROR 'Upgrade.spec.js (7:8)', 'a' Error: <spyOn> : test is not declared writable or has no setter Usage: spyOn(<object>, <methodName>) at

Webpack 3.5.5 debugging in chrome developer tools shows two source files. One under webpack:// and other under webpack-internal://

断了今生、忘了曾经 提交于 2021-02-07 02:46:43
问题 Migrated existing webpack project to use webpack 3.5.5 and its new config. Using express server instead of webpack-dev-server. I had to setup the resolve in webpack as below. const resolve = { extensions : ['.js'], modules : [ 'node_modules', 'src', 'testApplication' ] }; When i debug this webpack application using chrome developer tools I can see the 2 versions of source files. The first one under webpack:// It is exactly matching with the source The second one under webpack-internal:// This

How to import a static member of a class?

自闭症网瘾萝莉.ら 提交于 2021-02-04 19:49:14
问题 I am trying to import a static member of a class into a file by just using standard import syntax. To give context: Destructuring works on the static method of a class: class Person { static walk() { console.log('Walking'); } } let {walk} = Person; console.log(walk); // walk function However, I thought imports behaved like destructuring assignments. If that's true, then I would expect the following to work. But, when I attempt to import the walk method, it just comes back as undefined :

If babel converts let and const to var, what's the difference?

大憨熊 提交于 2021-02-04 19:16:08
问题 I've tried the babel transpiler, and it converts All let, const and var to just var, so in all, what's the difference in our code usage? I have read documents and I know what's the difference between let, const and var , but if all of them are eventually converted to var , what's the difference ? it means that there shouldn't be any meaningful differences in performance or even scope! Update (02.14.2019) : Based on the answers I understood that scope does matter and even though they are