I am getting a “KV GET failed: 401 Unauthorized” error and https://www.npmjs.com/package/@wordpress/env for example is also inaccessible
]]>For example, when having aconst calcNumbers = [ 1, 10, 3, 7 ];
, eslint will warn me to remove the first and last space within the brackets:3:22 warning Replace
·1,·10,·3,·7·
with 1,·10,·3,·7
prettier/prettier
As in the coding standard, the spaces have to be there.
Here’s my .eslintrc.json (located in my doc root where the package.json is)
Here’s my package.json (only part of the dev dependencies)
Any help would be appreciated.
]]>how can i set it so when user install plugin it runs npm commands?
]]>Our team uses the Members plugin within our WordPress application and recently started using SonarQube to scan our app, highlighting some vulnerable dependencies within our plugins. One that is coming up frequently is the Lodash libraries within different parts of the Members plugin. Older versions of this library have some Critical-level vulnerabilities (https://snyk.io/vuln/npm:lodash).
Just wanted to check if there is a plan in place to replace/update these vulnerable libraries / if any expected ETA exists.
Thanks very much!
]]>I’ve just started to create a new block and I’m wondering if it would be possible to use external npm packages and include them as dependencies for the block-editor/frontend.
I was not able to find any references or examples. I’ve tried including those dependencies in the array of dependencies when using wp_enqueue_script with no luck.
]]>Everything has gone well so far editing files in the src folder and seeing the results in the build folder. I have a working block but now want to be able to add front end javascript files (a front end block script and also a parallax script) but can’t figure out how to do it. I’ve put a script.js file in my src folder but can’t figure out how to get npm to include it into the build folder.
I’m sure it’s easy but I’ve trawled the internet and can’t figure out how to do it. Any help would be greatly appreciated. cheers!
]]>wp-env start
I’m on ubuntu 20.04 LTS, i’ve installed npm and nodejs.
dara@hp-laptop-ubuntu-20-04-lts:~$ npm -v
6.14.4
dara@hp-laptop-ubuntu-20-04-lts:~$ nodejs -v
v10.19.0
however when i try to start the instance I get
dara@hp-laptop-ubuntu-20-04-lts:~$ wp-env start
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '../build/Debug/nodegit.node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit/dist/nodegit.js:19:12)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
There’s a nodegit.node in Build/Release but not in Debug folder with nodegit in it …
]]>npm
. Currently, the front-end JavaScript is enqueued from a js file (ES5) that is not compiled. It works, but I was wondering if there is a better way to do (that would typically allow for a safe use of ESNext).
Some details about my current implementation:
The project was initiated using create-guten-block
and follows the obtained structured:
project
│ package.json
│ package-lock.json
│ plugin.php
│ readme.md
│
└── dist
│ │ blocks.build.js
│ │ blocks.editor.build.css
│ │ blocks.style.build.css
│
└── node_modules
│ │ ...
│
└── src
│ blocks.js
│ common.scss
│ init.php
│
└── block
│ block.js
│ editor.scss
│ style.scss
npm
compiles js and scss files from src/
to dist/
. plugin.php
includes init.php
, that refers to the js and css files in dist/
.
I added my ES5 javascript as frontend.js
in src/
(src/frontend.js
), and it is enqueued to my WordPress pages using:
function myblock_frontend_script() {
wp_enqueue_script(
'myblock-frontend',
plugins_url( 'src/frontend.js', dirname( __FILE__ ) ),
array( 'jquery' ),
null
);
}
add_action( 'wp_enqueue_scripts', 'myblock_frontend_script' );
As I said before, it works. But is there any way to have my src/frontend.js
compiled by npm
toward dist/
(as src/blocks.js
and hence the included src/block/block.js
is), so that I can use ESNext+JSX?
npm install
and am using the latest version of node.js (v12.2.0) that was installed with nvm. I’m assuming that the issue is that I need an earlier version of node but I can’t seem to find which version the theme was built with. There’s not one single error either so I’m not sure how to proceed from here without dumping the entire log.
node v12.2.0
nvm 0.34.0
python v2.7.10