JavaScript for WordPress › Forums › The WP REST API › 2.1.13.02 Setting Up The Project
- This topic has 4 replies, 2 voices, and was last updated 7 years, 9 months ago by
Juliette Tworsey.
-
AuthorPosts
-
January 6, 2018 at 7:56 pm #36837
Juliette Tworsey
ParticipantHi Zac,
First of all, Happy New Year! I haven’t been here for a few months and I’m trying to get back into the swing of immersing myself in this course.
In following along with 2.1.13.02 I am unable to get Webpack to build successfully after running npm i –save (Node V7.10.1). Instead, I am getting this error:
ERROR in ./src/index.js Module build failed: ReferenceError: Unknown plugin "transform-runtime" specifiedI haven’t encountered this error before and I was wondering if anyone else has, and if so, is there a solution?
I did try (after some searching) installing
babel-preset-stage-2to see if that would remedy the issue, but it did not resolve the error.Thanks so much!
Juliette
January 6, 2018 at 10:04 pm #36859Zac Gordon
KeymasterHey Juliette!
Sounds like you just need to install transform-runtime, which helps with preventing code completion.
If there is a package.json file then you just need to run npm install to pull down everything you need.
Hope that helps!!!
January 7, 2018 at 3:57 am #36892Juliette Tworsey
ParticipantHi Zac!
That (along with the addition of a .babelrc file) did the trick.
Thanks so much!
January 7, 2018 at 1:45 pm #36934Zac Gordon
KeymasterOh great!
Do you think there is something wrong with the code I provided in the examples? Please let me know and I’ll post updates 🙂
Cheers!
ZacJanuary 7, 2018 at 7:24 pm #36960Juliette Tworsey
ParticipantHi Zac,
I don’t think that there is anything wrong (that I know of) with the code that you have provided in the examples, though I did have to add a .babelrc file (via a recommendation from Babel https://babeljs.io/docs/plugins/transform-runtime/ ).
This is what I have added to my .babelrc file:
{ "presets": [ "es2015" ], "plugins": [ ["transform-runtime", { "helpers": false, "polyfill": false, "regenerator": true, "moduleName": "babel-runtime" }] ] }I realize that including es2015 in this file may be redundant(?) due to the fact that es2015 is already listed as a preset in the
webpack-config.jsfile. I’m relatively new to Webpack so I just put it in there for safe measure. Is this an unneeded action?Cheers:-)
-
AuthorPosts
- You must be logged in to reply to this topic.
