Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 11 days ago.
Improve this question
"scripts": {
...
"build:icons": "rollup ./generated_js/index.js --file ./dist/icons.js --format es --name \"svgs\""
},
What does --file does?
In index.js, I have this:
In ./dist/icons.js, I have this:
I want to know what does --file do exactly, and why is the export {..} statement included in icons.js file, and how to remove it from there.
Generally scripts:build will create a build file , --file with output file name ( which you havent mentioned , if you mention any file name the output of build file will be stored in that file which you have mentioned.)
useful source of info can be found here :
https://rollupjs.org/command-line-interface/#command-line-flags
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 months ago.
Improve this question
I am suddenly facing this issue that seemingly came out of nowhere. The project I am working on in my company is rather large and we are using a micro frontend architecture. I was working in one branch yesterday and after building and pushing my code, I checked out to another branch to check something and then went back to the original branch I was in. After trying to serve the application again, I was faced with this error. It seems everyone else on the team is getting this error, too. Even those who haven't pulled the code I pushed.
Here is the error:
Error: ./node_modules/cheerio/node_modules/htmlparser2/lib/esm/index.js 59:9
Module parse failed: Unexpected token (59:9)
File was processed with these loaders:
./node_modules/#angular-devkit/build-angular/src/babel/webpack-loader.js
./node_modules/#angular-devkit/build-angular/node_modules/#ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| return getFeed(parseDOM(feed, options));
| }
export * as DomUtils from "domutils";
| // Old name for DomHandler
| export { DomHandler as DefaultHandler };
Error: ./node_modules/cheerio/node_modules/parse5/dist/index.js 6:9
Module parse failed: Unexpected token (6:9)
File was processed with these loaders:
./node_modules/#angular-devkit/build-angular/src/babel/webpack-loader.js
./node_modules/#angular-devkit/build-angular/node_modules/#ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| export { serialize, serializeOuter } from './serializer/index.js';
| /** #internal */
export * as foreignContent from './common/foreign-content.js';
| /** #internal */
| export * as html from './common/html.js';
I've tried:
updating cheerio
deleting node_modules and package-lock, then running npm i
deleting cheerio
reverting back to before I pushed my code
Really not sure what else to do. This is my first stack overflow question so sorry if I'm missing any necessary info.
EDIT: I found two links on github
https://github.com/umijs/umi/issues/8109
https://github.com/cheeriojs/cheerio/issues/2545
and after following their instructions, I added cheerio to dev dependencies in package.json and then installed the 'stream' package. The error is resolved for the time being.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Error: Cannot find module '/Users/alejandraola/Documents/GitHub/SCL16-md-link/prueba.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I expected to be able to. move the files to an src folder and run the files from there.
The error means that node cannot find the module any more after it moved
I think you are importing these files somewhere inside your code,
you need to find this and change it to the new directory,
it will be something similar to this :
require("/prueba.js");
If you moved it to Src folder then add this to the path as well
require("/src/prueba.js");
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have a problem with prettier.
I'm trying to update prettier version in Angular project. After moving to 2.0.5 version, prettier do not see some options from config file.
Config in package.json file looks like this:
"prettier": {
"trailingComma ": "none",
"htmlWhitespaceSensitivity": "strict",
"semi": true,
"singleQuote": true,
"printWidth": 140,
"arrowParens": "avoid",
"tabWidth": 2,
"endOfLine": "auto"
},
Unfortunately, this does not work. When I'm running prettier from console I got an error and prettier messing up trailing commas in all files (I don't want them).
$ prettier --write --config ./package.json "src/**/*.ts"
Ignored unknown option { "trailingComma ": "none" }. Did you mean trailingComma?
How can I fix this?
There is a single space between the word trailingComma and the ". Try to remove it in your config file.
"trailingComma": "none",
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a lot of js files in my View(html page),and I wonder if there is a way to
combine all my js reference to one ref .
You can use webpack to compile your javascript files and create a bundle file.
Webpack has a lot of documentation and tutorials.
If you're using .NET MVC, have a look at
http://www.asp.net/mvc/overview/performance/bundling-and-minification
If you are developing using plain JS & HTML, gulp could be an alternative with the gulp-bundle package.
var gulp = require('gulp'),
bundle = require('gulp-bundle');
gulp.task('bundle', bundle('./app/*.js', {
appDir: 'app',
buildDir: 'dist',
minify: true
}));
which would take all js files in the app directory, bundle them and minify to the 'dist' directory.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have around 40 JS files on all pages that needs to be loaded.How can I merge multiple js files into 1 JS file , So that I have to make less http request.
The best way is to use a task runner such as gulp. Read more on how to install it here
The following would merge all .js files in the ./assets/js directory into one file in the ./public/js directory.
// Require gulp
var gulp = require('gulp');
// Require plugins
var concat = require('gulp-concat');
gulp.task('scripts', function() {
return gulp.src(['./assets/js/*.js'])
.pipe(concat('main.min.js'))
.pipe(gulp.dest('./public/js'));
});
It is then possible to run this script with gulp scripts in the command line from within the project directory.
Use automation tools like Gulp or Grunt to concatenate, minify, build sourcemaps, and do everything you want with your sources. Sample build script looks like this:
var gulp = require('gulp'),
concat = require('gulp-concat'),
sourcemaps = require('gulp-sourcemaps');
gulp.task('build-js', function() {
return gulp.src('source/javascript/**/*.js')
.pipe(sourcemaps.init())
.pipe(concat('bundle.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('public/assets/javascript'));
});
After that everything you need is run gulp build-js