Plugin 0 specified in babel-preset-es2015 provided an invalid property of _c - babeljs

Getting above error with below configuration, commenting passPerPreset removes the error however. Is there any configuration missing ?
.babelrc :
{
"passPerPreset": true,
"presets": [{
"plugins": [
"./build/babelRelayPlugin",
"transform-runtime",
"transform-es2015-classes"
]
}, "es2015", "stage-0", "react"],
"env": {
"development": {
"presets": ["react-hmre"]
}
}
}
package.json :
"babel-cli": "^6.5.1",
"babel-core": "^6.5.2",
"babel-eslint": "^4.1.8",
"babel-loader": "^6.2.2",
"babel-plugin-react-transform": "^2.0.0",
"babel-plugin-transform-es2015-classes": "^6.5.2",
"babel-plugin-transform-runtime": "^6.5.2",
"babel-polyfill": "^6.5.0",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0",
"babel-preset-react-hmre": "^1.1.0",
"babel-preset-stage-0": "^6.5.0",
"babel-relay-plugin": "^0.7.0",
"babel-runtime": "^6.5.0",
Webpack :
module: {
loaders: [
{
loader: "babel-loader",
include: [
path.resolve(__dirname, "app"),
],
test: /\.jsx?$/,
query: {
plugins: ['transform-runtime'],
presets: ['react', 'es2015', 'stage-0'],
}
},
]
},
Error : babel-node start
Module build failed: Error: Plugin 0 specified in "/Users/my/demo/node_modules/babel-preset-es2015/index.js" provided an invalid property of "_c"

What worked for me was:
rm -rf node_modules
npm prune
npm cache clear
npm cache clean
npm i

Upgrading babel-core and babel-loader fixed this for me.
npm install --save babel-core#latest babel-loader#latest

I think that there might be contention between what you've specified in .babelrc and what you've configured in babel-loader.
Can you try to remove the query from your Webpack config?

I had the same problem, but removing and rebuilding node_modules as Alex suggested didn't help in my case.
It turned out that there was some version mismatch with may packages. When I deleted all the dependencies and devDependencies from package.json and added them again by npm i -S or npm i -D respectively, everything started to work again.

Clearing my node_modules etc didn't work. However, commenting-out passPerPreset did the trick. TBH I'm not really sure what that option does, but most of the google hits on it are bug reports, so I'm fine so long as it works.
// babelrc
{
//"passPerPreset": true,
"presets": [
"stage-0",
"react-app"
],
"plugins": [
"transform-runtime",
"syntax-async-functions",
"transform-decorators-legacy",
"transform-class-properties",
"react-relay"
]
}

Updating my npm version solved this problem.

Related

Sanity Deployment on Vercel Issue: Cannot find module 'sanity' even though package is installed

So i'm trying to deploy sanity/nextjs on vercel. It runs fine locally but for the production build I keep getting the same error.
Here's the main error:
> build
> next build
info - Linting and checking validity of types...
Failed to compile.
./sanity/sanity.config.ts:1:28
Type error: Cannot find module 'sanity' or its corresponding type declarations.
> 1 | import {defineConfig} from 'sanity'
| ^
2 | import {deskTool} from 'sanity/desk'
3 | import {visionTool} from '#sanity/vision'
4 | import {schemaTypes} from './schemas'
Error: Command "npm run build" exited with 1
My sanity package.json:
{
"name": "nft-drop",
"private": true,
"version": "1.0.0",
"main": "package.json",
"license": "UNLICENSED",
"scripts": {
"dev": "sanity dev",
"start": "sanity start",
"build": "sanity build",
"deploy": "sanity deploy",
"deploy-graphql": "sanity graphql deploy"
},
"keywords": [
"sanity"
],
"dependencies": {
"#sanity/vision": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"sanity": "^3.0.0",
"styled-components": "^5.2.0"
},
"devDependencies": {
"#sanity/cli": "^3.2.3",
"#sanity/eslint-config-studio": "^2.0.1",
"eslint": "^8.6.0",
"prettier": "^2.8.3",
"typescript": "^4.0.0"
},
"prettier": {
"semi": false,
"printWidth": 100,
"bracketSpacing": false,
"singleQuote": true
}
}
My main folder package.json:
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"#next/font": "^13.1.2",
"#sanity/image-url": "^1.0.1",
"#thirdweb-dev/react": "^3.6.9",
"#thirdweb-dev/sdk": "^3.6.9",
"ethers": "^5.7.2",
"next": "latest",
"next-sanity": "^4.0.6",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"#sanity/cli": "^3.2.3",
"#types/node": "18.11.3",
"#types/react": "18.0.21",
"#types/react-dom": "18.0.6",
"autoprefixer": "^10.4.12",
"postcss": "^8.4.18",
"tailwindcss": "^3.2.4",
"typescript": "4.9.4"
}
}
Thanks for your help.
I've checked that I have the 'sanity' package installed. I've added the recommended 'vercel.json' file and I also have the #sanity/cli installed. I've checked my local env setup to make sure that was also on vercel.
Maybe i've overinstalled the sanity packages in trying to solve it?
This is my first time using sanity, nextjs, and vercel so I've run out of ideas and haven't found the same issue answered elsewhere yet.
I had this issue as well, and it seems to be related to Sanity v3 which only came out a month ago - I rolled back to sanity v2 and it fixed the deployment issue
You can try to add .vercelignore in the root file and add sanity in there to ignore the whole folder
The fix is to move your sanity client config file (aka wherever you have your .env variables setup - in my case: sanity.ts) into a lib folder in the root directory. If the file itself is in the root directory, it will not build.
Updating the import statement from
import {defineConfig} from 'sanity'
to
import {defineConfig} from 'sanity/lib/exports'
worked for me.

I have plugin built in craft cms3, I want to use same plugin in craft cms4

I have simply copy and paste plugin( plugin name is websitetoolbox) folder to craft cms4's vendor folder. And modify root composer.json like below.
{
"require": {
"craftcms/cms": "^4.2.0.2",
"swishdigital/template-selector": "^1.0",
"vlucas/phpdotenv": "^5.4.0",
"websitetoolbox/websitetoolboxforum": "1.4.0"
},
"require-dev": {
"yiisoft/yii2-shell": "^2.0.3"
},
"autoload": {
"psr-4": {
"modules\\": "modules/"
}
},
"config": {
"allow-plugins": {
"craftcms/plugin-installer": true,
"yiisoft/yii2-composer": true
},
"sort-packages": true,
"optimize-autoloader": true,
"platform": {
"php": "8.0.2"
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
When I run command composer update it gives below error
Problem 1
- Root composer.json requires websitetoolbox/websitetoolboxforum 1.4.0, found websitetoolbox/websitetoolboxforum[dev-master, 1.0.0, 1.3.0] but it does not match the constraint.
The line:
"websitetoolbox/websitetoolboxforum": "1.4.0"
Should probably be:
"websitetoolbox/websitetoolboxforum": "1.3.0"
I'm no expert on semantic versioning, but it seems a bit odd that you have a higher version number? Could it be a typo on your end? Cause if another dependency requires this version you might be in trouble.

'import' and 'export' may appear only with 'sourceType: module when import "#solana/web3.js"

I am going to use solanaweb3 on babelrc project.
When I run npm start I am getting .
I have gone through many posts on github and stackoverflow.
npm install -g browserify
npm install --save-dev browserify babelify babel-preset-es2015 babel-preset-stage-0 babel-preset-env babel-preset-react
npm install #babel/core --save
What is solution?
Here is my package.json content.
"scripts": {
"start": "budo src/index.js"
},
"dependencies": {
"#babel/runtime": "^7.14.8",
"#solana/web3.js": "^1.29.2",
"babel-core": "7.0.0-bridge.0"
},
"devDependencies": {
"#babel/core": "^7.15.5",
"#babel/plugin-transform-runtime": "^7.15.0",
"#babel/preset-env": "^7.15.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babelify": "^10.0.0",
"browserify": "^16.5.2",
"budo": "^11.6.4"
},
"browserify": {
"transform": [
[
"babelify",
{
"presets": [
"#babel/preset-env"
]
}
]
]
}
}

Getting error "Support for the experimental syntax 'classProperties' isn't currently enabled " when removing #babel/plugin-proposal-class-properties

I would like to remove the #babel/plugin-proposal-class-properties plugin as we are now targeting chrome 79 which supports class properties. I would imagine that removing this plugin shouldn't be a problem because we no longer need babel to transpile that code.
When I remove the plugin from the plugins section of the babelrc file, I am getting an error -
Module build failed (from ./node_modules/babel-loader/lib/index.js), ...
"Support for the experimental syntax 'classProperties' isn't currently enabled "
Relevant Package.json entries:
"#babel/core": "^7.0.0",
"#babel/preset-env": "^7.0.0",
"webpack": "4.40.0",
Here is my .babelrc file
{
"presets": [
"#babel/preset-react",
[
"#babel/preset-env",
{
"targets": {
"chrome": 79
}
}
],
"#babel/preset-typescript"
],
"plugins": [
"babel-plugin-styled-components"
]
}
Here is my webpack config, relevant loader configuration:
{
test: /\.(js(x)?|ts(x)?)$/,
exclude: [/node_modules/],
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}
]
},
Any help or insight would be appreciated.

Facing issue, when serenity js library is included for Cucumber protractor typescript tests

I am learning Cucumber BDD with serenity js library for reporting purpose off Angular website . I am using Type script as programming language.
I am able to generate the cucumber report for different feature file scenarios. But when i am trying to include the serenity library for report enhancement, i am facing the below issue. -
Issue is :
PS R:\protractor\protractor-cucumber-typescript> tsc
PS R:\protractor\protractor-cucumber-typescript> npm test
> protractor-typescript-cucumber#3.0.0 pretest R:\protractor\protractor-cucumber-typescript
> serenity update
info: Serenity BDD CLI jar file is up to date :-)
> protractor-typescript-cucumber#3.0.0 test R:\protractor\protractor-cucumber-typescript
> protractor typeScript/config/config.js
[15:29:46] I/launcher - Running 1 instances of WebDriver
[15:29:46] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[15:29:54] E/launcher - Error: TypeError: Path must be a string. Received true
at assertPath (path.js:7:11)
at Object.basename (path.js:801:5)
at R:\protractor\protractor-cucumber-typescript\node_modules\cucumber\lib\cucumber\cli\configuration.js:11:27
at Array.forEach (native)
at Function.Configuration (R:\protractor\protractor-cucumber-typescript\node_modules\cucumber\lib\cucumber\cli\configuration.js:10:10)
at getConfiguration (R:\protractor\protractor-cucumber-typescript\node_modules\cucumber\lib\cucumber\cli.js:63:38)
at Object.run (R:\protractor\protractor-cucumber-typescript\node_modules\cucumber\lib\cucumber\cli.js:69:27)
at R:\protractor\protractor-cucumber-typescript\node_modules\serenity-js\src\serenity-cucumber\cucumber_test_framework.ts:24:51
at CucumberTestFramework.run (R:\protractor\protractor-cucumber-typescript\node_modules\serenity-js\src\serenity-cucumber\cucumber_test_framework.ts
:21:16)
at R:\protractor\protractor-cucumber-typescript\node_modules\serenity-js\src\serenity-protractor\framework\serenity_protractor_framework.ts:52:35
[15:29:54] E/launcher - Process exited with error code 100
npm ERR! Test failed. See above for more details.
Its not giving any traces of the files i have. Its showing me a different file.
Serenity dependency got downloaded, But when the protractor conf.js file run. I am getting above issue
Files look like below -
Conf.ts file looks like below :
import * as path from "path";
import { browser, Config } from "protractor";
const crew = require('serenity-js/lib/stage_crew');
export const config: Config = {
seleniumAddress: "http://127.0.0.1:4444/wd/hub",
SELENIUM_PROMISE_MANAGER: false,
// baseUrl: "http://www.google.com",
baseUrl2: "https://angularjs.org/",
framework: "custom",
frameworkPath: require.resolve('serenity-js'),
specs: [
"../../features/*Home.feature",
],
cucumberOpts: {
// require: ["../../stepdefinitions/*.ts","../../support/stepdefinitions/*.js"],
require: ["stepdefinitions/*/**.ts","support/stepdefinitions/*/**.js"],
// strict: true,
format: "pretty",
compiler: "ts:ts-node/register",
},
serenity: {
dialect: 'cucumber',
crew: [
crew.serenityBDDReporter(),
crew.photographer(),
crew.consoleReporter()
]
},
capabilities: {
browserName: "chrome",
},
onPrepare: () => {
browser.ignoreSynchronization = true;
browser.manage().window().maximize();
browser.get("https://angularjs.org/");
},
};
My package.json file looks like below :
{
"name": "protractor-typescript-cucumber",
"keywords": [
"protractor",
"cucumber",
"typescript",
"angular",
"angularjs",
"testing",
"behaviour driven development",
"bdd",
"selenium",
"webdriverJS",
"gherkin",
"automation testing"
],
"main": "index.js",
"scripts": {
"build": "tsc",
"clean": "rimraf typeScript/",
"clean-build": "npm run clean && npm run build",
"test": "protractor typeScript/config/config.js",
"webdriver-update": "webdriver-manager update",
"webdriver-start": "webdriver-manager start",
"pretest": "serenity update",
"report": "serenity run"
},
"devDependencies": {
"#types/cucumber": "^2.0.4",
"#types/node": "^8.0.3",
"#types/selenium-webdriver": "^3.0.7",
"chai": "^4.0.2",
"chai-as-promised": "^7.0.0",
"chai-smoothie": "^0.3.2",
"cucumber": "1.3.2",
"cucumber-html-reporter": "^3.0.4",
"mkdirp": "^0.5.1",
"protractor": "^5.1.2",
"protractor-cucumber": "^0.1.8",
"protractor-cucumber-framework": "^4.0.8",
"rimraf": "^2.6.2",
"serenity-cli": "^0.2.4",
"serenity-js": "^1.4.1",
"standard-loader": "^6.0.1",
"ts-node": "^3.3.0",
"typescript": "^2.5.3"
},
"dependencies": {
"#types/chai": "^4.0.4"
}
}
Please update me, where i am going wrong