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",
Related
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
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 3 months ago.
Improve this question
I was learning JavaScript and kind of ran into problem that said like this :
Error Image
Here's my package.json
enter image description here
So to explain, this is my vanilla js where i have installed parcel
Vs code Terminal
npm i parcel --save-dev
npm run start
npm run build
theen this error pops up. I don't know if i added enough screenshots or details to make someone understand my problem. If you do have a solution help please.
Edit : I also tried,
"main" : "17th.html" as suggested which then threw new error saying the extension should be of .js
Final edit : So , i deleted "main" and then it worked like a charm. Dont know why it works but it works . If someone could explain why it works then i would be very grateful.
I was expeccting a successful build
I had the same issue, what worked for me was just deleting
main: "filepath"
You can also organize this better by having a src folder and moving all your html files there, a js folder which contains all your js files and a css folder that contains all your css files.
Below is my paackage.json which builds as intended.
{
"name": "something",
"version": "1.0.0",
"description": "stackoverflow example",
"scripts": {
"dev": "parcel src/index.html",
"build": "parcel build src/index.html"
},
"author": "my name",
"license": "ISC",
"devDependencies": {
"#parcel/transformer-sass": "^2.6.2",
"parcel": "^2.6.2"
},
"dependencies": {
"gsap": "npm:#gsap/shockingly#^3.10.4"
}
}
Entry should be an html file like
main: "17th.html"
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 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