I am trying to bundle an web application that written with ES6 module system & using rollup from command line with custom modules folder that I want use it as root modules directory to be resolved. Then I downloaded some packages to that custom folder with yarn add --modules-folder <custom folder path>. Now When I am using this command rollup -w -i App.js -o bundle.js -p '<modules path>/#rollup/plugin-babel={presets:["<modules path>/babel-preset-solid"]}' -p '<modules path>/#rollup/plugin-node-resolve={extensions:[".js"],customResolveOptions:{moduleDirectory:"<modules path>"}}' I am getting this error (node:13672) UnhandledPromiseRejectionWarning: Error: Cannot load plugin "<modules path>/#rollup/plugin-babel": Cannot find module '<modules path>/#rollup/plugin-babel' But I am pretty sure that all packages are in custom moduels folder path. But strangely when do same process and download packages to custom location with node_modules folder in it, It works fine. So what is the problem? What am I missing here?
Related
i'm tying yo host vue webaplication on namecheap hosting. when i install i open it in console has error Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../"
To install a vue project you need to compile it to production. First go to your project and open a terminal, then type npm run build
Vue will build your project for production and leave the result into your dist folder. Then you can upload only the contents of the dist folder into your server
even if it seems a simple task I'm having some trouble finding a solution. I know that with Nest CLI I can use the command "nest build" in order to create a dist folder that contains the production files of my project.
The problem is when I move the folder on my Raspberry and i try to run the project with the command "node dist/main" following NestJs instructions. Nothing starts because node says that it cannot find #nestjs/core and other modules.
I did't find nothing clear in the official guide about deploying the app, so my question is: what do I need to move onto my rasperry in addition to dist folder? Do I need to reinstall all node_modules folder or it's possible to have a running project without have to reinstall 800Mb of modules?
Yes you need to run yarn or npm install on your production environment, as your dist folder only contains your own code.
Because unlike compiled language like Golang where all dependencies are bundled and compiled in you executable file, Javascript bundlers don't. Your bundled code in dist still contains require or import statement to get dependencies from node_modules.
You can also run npm prune --production to remove any developpement dependencies and thus reduce the size of your node_modules folder. (I believe that yarn does it by default.)
I want to use my compiling scripts in different projects as a submodule of GIT modules.
I added the submodule into a directory named build, and there is a gulpfile.js in the build dir.
I created another gulpfile.js in the root dir of the project, then using this gulpfile.js to invoke the real gulpfile.js in build dir.
After I running the gulp command, I got an error message that told me that "Task 'default' is not in your gulpfile".
I don't want to manage any dependence in each project that going to use this build, I just want to find out a way to invoke the real gulpfile.
What shall I do? Thanks a lot.
You may need to either set a gulp cli config file .gulp.json with a property setting the path to your custom gulpfile, or use gulp --gulpfile [path]. More on this on the github readme page of gulp-cli https://github.com/gulpjs/gulp-cli/blob/master/README.md
I am exploring transitioning a browserify build to jspm.
browserify leaves code like:
require("defaults.json")
intact and finds the file "defaults.json" in the source directory and injects it into a structure that can be read by browserify's provided require()
jspm is instead providing an error:
jspm build main.js bundle.js
Building the bundle tree for main.js...
err Error on fetch for defaults.json.js at file:///tmp/testapp/defaults.json.js
Loading main.js
Error: ENOENT: no such file or directory, open '/tmp/testapp/defaults.json.js'
at Error (native)
Notice that:
the error is ENOENT, no such file.
because it adds ".js" onto the file name, becoming defaults.json.js, not defaults.json as appears in the require call.
I tried installing a json plugin for jspm with
jspm install json
That did not help, returning the same error on build. Reinstalling with rm -rf ./jspm_packages and jspm install also return the same error on build.
How do I include the json file into the jspm build?
As #Patrick hinted:
require('defaults.json!')
works once the jspm json plugin is loaded with jspm install json.
require('defaults.app!json')
can be used in case the JSON-formatted file is not named with the .json extension.
jspm Docs explain this clearly for ES6 import and apparently it is the same filename syntax in require.
this is probably a silly question but am new to Meteor and struggling a bit. I want to build a stellar app that tweets when you get stellar. There is a nice Javascript API stellar-lib that works on node, but im unsure how to access the modules in Meteor...
I'm also building an app with Meteor and stellar-lib and have found two options:
1) You can manually copy over the built stellar-lib.js or stellar-lib-min.js from the build/ directory from either the github repo or the node_modules folder you installed it to when you ran the npm install command.
If you do this, you will have to copy the .js file to client/compatibility, otherwise stellar-lib will not work (note: this means you can only use Stellar on the client).
2) If you need it on the server, you can also have browserify wrap stellar-lib for you, then copy the output to lib/ in your Meteor app's root directory. I did this in my repo here with gulp.
Here's a short explanation to how 2) works:
.gulp is where I'll install my NPM modules where they will be ignored by the Meteor build environment (because the folder is hidden).
In deps.js, I require the modules I would want to use in my Meteor app as I would if I was using them in a traditional node.js app. package.json defines the modules I'll install with NPM and the gulpfile.js describes a build task that will resolve my require statements and output a single deps.js file that includes my dependencies to my Meteor app's lib/ folder.