`npm run` does not support with webpack - npm

I'm working on a web pack based project. I use npm runto check my interface.
Below is my package.json file content.
"scripts": {
"build": "webpack --config webpack.config.prod.js",
"start": "webpack --config webpack.config.dev.js"
},
"devDependencies": {
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.0.1",
"html-webpack-plugin": "^4.5.0",
"mini-css-extract-plugin": "^1.3.1",
"raw-loader": "^0.5.1",
"sass": "^1.29.0",
"sass-loader": "^10.1.0",
"script-loader": "^0.7.2",
"style-loader": "^2.0.0",
"webpack": "^5.9.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.4.0"
}
below is my webpack.config.dev.js file content.
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { default: merge } = require("webpack-merge")
const superConfig = require('./webpack.config');
module.exports=merge(superConfig,{
devServer:{
port: 3000
},
devtool: false,
mode:'development',
plugins:[new MiniCssExtractPlugin({
filename: 'main.css'
})]
})
In here I have mentioned the port 3000 for npm run.
But
the terminal shows
(node:11002) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
(Use `node --trace-deprecation ...` to show where the warning was created)
[webpack-cli] Compilation finished
assets by status 2.81 MiB [cached] 15 assets
assets by path . 1.28 MiB
asset main.css 751 KiB [compared for emit] (name: main)
asset main.bundle.js 542 KiB [compared for emit] (name: main)
asset index.html 14.4 KiB [compared for emit]
Entrypoint main 1.26 MiB (2.81 MiB) = main.css 751 KiB main.bundle.js 542 KiB 15 auxiliary assets
runtime modules 931 bytes 4 modules
cacheable modules 530 KiB
modules by path ./node_modules/ 529 KiB
modules by path ./node_modules/admin-lte/plugins/ 472 KiB 8 modules
2 modules
modules by path ./src/ 971 bytes
./src/index.js 465 bytes [built] [code generated]
./src/js/menu.js 456 bytes [built] [code generated]
./src/scss/style.scss 50 bytes [built] [code generated]
css modules 751 KiB
modules by path ./node_modules/admin-lte/plugins/ 77.5 KiB
css ./node_modules/css-loader/dist/cjs.js!./node_modules/admin-lte/plugins/fontawesome-free/css/all.min.css 58 KiB [code generated]
css ./node_modules/css-loader/dist/cjs.js!./node_modules/admin-lte/plugins/overlayScrollbars/css/OverlayScrollbars.min.css 19.5 KiB [code generated]
css ./node_modules/css-loader/dist/cjs.js!./node_modules/admin-lte/dist/css/adminlte.min.css 673 KiB [code generated]
css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/scss/style.scss 0 bytes [code generated]
webpack 5.9.0 compiled successfully in 5050 ms
and 3000 port doesn't support. But when I open the index.html file in the dist folder it opens very well without any issue.

OK, I got the answer. The solution is to change
"start": "webpack --config webpack.config.dev.js"
to
"start": "webpack serve --config webpack.config.dev.js"
in the package.json file.

Related

Why does Vercel repeat downloading and installing on build?

I have a Vite and Vue.js webapp hosted on Vercel. Every time I deploy it, the downloading/installing process happens multiple times — 7 to be precise. Why does it repeat?
Build log:
Cloning github.com/* (Branch: main, Commit: *)
Cloning completed: 719.461ms
Installing build runtime...
Build runtime installed: 1.038s
Installing build runtime...
Build runtime installed: 985.054ms
Installing build runtime...
Build runtime installed: 930.743ms
Installing build runtime...
Build runtime installed: 923.02ms
Installing build runtime...
Build runtime installed: 1.004s
Installing build runtime...
Build runtime installed: 911.844ms
Installing build runtime...
Build runtime installed: 1.728s
Looking up build cache...
Looking up build cache...
Looking up build cache...
Looking up build cache...
Looking up build cache...
Build cache downloaded [50.34 MB]: 5158.433ms
Build cache downloaded [50.34 MB]: 5433.283ms
Build cache downloaded [50.34 MB]: 5694.941ms
Build cache downloaded [50.34 MB]: 6005.223ms
Installing dependencies...
Build cache downloaded [50.34 MB]: 5981.376ms
Installing dependencies...
Installing dependencies...
Installing dependencies...
Installing dependencies...
up to date in 2s
76 packages are looking for funding
run `npm fund` for details
up to date in 1s
76 packages are looking for funding
run `npm fund` for details
up to date in 1s
76 packages are looking for funding
run `npm fund` for details
up to date in 2s
76 packages are looking for funding
run `npm fund` for details
up to date in 2s
76 packages are looking for funding
run `npm fund` for details
Installing dependencies...
Looking up build cache...
up to date in 1s
76 packages are looking for funding
run `npm fund` for details
Build cache downloaded [50.34 MB]: 3225.874ms
Installing dependencies...
up to date in 1s
76 packages are looking for funding
run `npm fund` for details
Detected `package-lock.json` generated by npm 7+...
Running "npm run build"
> *#* build
> vite build
vite v2.9.13 building for production...
transforming...
✓ 109 modules transformed.
rendering chunks...
Why does Vercel repeat downloading and installing on build?
My “vercel.json” file:
{
"cleanUrls": false,
"trailingSlash": false,
"rewrites": [
{ "source": "([^#.]*)", "destination": "/index.html" }
],
"redirects": [
{ "source": "/", "destination": "*" }
],
"headers": [
{
"source" : "(.*)",
"headers" : [
{ "key" : "Content-Security-Policy" , "value" : "*" }
]
}
]
}
My “package.json” file:
{
"name": "*",
"version": "*",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview --port 4173",
"test:unit": "vitest --environment jsdom",
"test:e2e": "start-server-and-test preview http://127.0.0.1:4173/ 'cypress open --e2e'",
"test:e2e:ci": "start-server-and-test preview http://127.0.0.1:4173/ 'cypress run --e2e'",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^6.1.1",
"#fortawesome/free-brands-svg-icons": "^6.1.1",
"#fortawesome/free-regular-svg-icons": "^6.1.1",
"#fortawesome/free-solid-svg-icons": "^6.1.1",
"#fortawesome/vue-fontawesome": "^3.0.1",
"#popperjs/core": "^2.11.5",
"bootstrap": "^5.1.3",
"dotenv": "^16.0.1",
"mitt": "^3.0.0",
"mongodb": "^4.7.0",
"node-mailjet": "^5.0.1",
"vue": "^3.2.37",
"vue-router": "^4.0.16"
},
"devDependencies": {
"#rushstack/eslint-patch": "^1.1.0",
"#vitejs/plugin-vue": "^2.3.3",
"#vue/eslint-config-prettier": "^7.0.0",
"#vue/test-utils": "^2.0.0",
"axios": "^0.27.2",
"cheerio": "^1.0.0-rc.12",
"crypto": "^1.0.1",
"cypress": "^10.1.0",
"eslint": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-vue": "^9.0.0",
"jsdom": "^20.0.0",
"prettier": "^2.5.1",
"start-server-and-test": "^1.14.0",
"vercel": "^26.0.0",
"vite": "^2.9.12",
"vitest": "^0.15.1"
}
}

Storybook Failed in Very First Try in New Create-React-App

I'm a junior front-end, and trying to learn Storybook for work.
I just created new react app with create-react-app and run npm start.
And it failed just in the screenshot below.
npm start failed error
But I just solved it after seeing an answer from stack-overflow just like in the screenshot below.
solved error of react-scripts#4.0.3
And I initiated storybook in my new react project with npx sb init just like the documentation says. It is succeed by creating .storybook folder and some example stories under src folder. Then, I run npm run storybook, and so many error appears in the console.
$ npm run storybook
> learn-storybook-5#0.1.0 storybook
> start-storybook -p 6006 -s public
info #storybook/react v6.4.9
info
(node:15528) DeprecationWarning: --static-dir CLI flag is deprecated, see:
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated---static-dir-cli-flag
(Use `node --trace-deprecation ...` to show where the warning was created)
info => Loading presets
info Found existing addon "#storybook/addon-docs", skipping.
info Found existing addon "#storybook/addon-actions", skipping.
info => Serving static files from ./public at /
info => Loading Webpack configuration from `node_modules\react-scripts`
info => Removing existing JavaScript and TypeScript rules.
info => Modifying Create React App rules.
info => Using default Webpack4 setup
10% building 1/1 modules 0 activeWARN Expected '#storybook/addon-docs' (or '#storybook/addon-essentials') to be listed before '#storybook/addon-controls' (or '#storybook/addon-essentials') in main Storybook config.
13% building 27/33 modules 6 active D:\311's learning\learn-storybook-5\node_modules\#pmmmwh\react-refresh-webpack-plugin\client\utils\safeThis.js
info => Using cached manager
webpack built preview d035dbd78ee6247b1305 in 9381ms
× 「wdm」: Hash: d035dbd78ee6247b1305
Version: webpack 4.44.2
Time: 9381ms
Built at: 12/10/2021 3:29:06 PM
Asset Size Chunks Chunk Names
0.iframe.bundle.js 226 KiB 0 [emitted]
0.iframe.bundle.js.map 215 KiB 0 [emitted] [dev]
1.iframe.bundle.js 206 KiB 1 [emitted]
1.iframe.bundle.js.map 145 KiB 1 [emitted] [dev]
2.iframe.bundle.js 9.15 KiB 2 [emitted]
2.iframe.bundle.js.map 6.47 KiB 2 [emitted] [dev]
3.iframe.bundle.js 92.4 KiB 3 [emitted]
3.iframe.bundle.js.map 84.3 KiB 3 [emitted] [dev]
4.iframe.bundle.js 372 KiB 4 [emitted] [big]
4.iframe.bundle.js.map 412 KiB 4 [emitted] [dev]
5.iframe.bundle.js 15.7 KiB 5 [emitted]
5.iframe.bundle.js.map 16.6 KiB 5 [emitted] [dev]
asset-manifest.json 1.67 KiB [emitted]
iframe.html 11.4 KiB [emitted]
main.iframe.bundle.js 111 KiB main [emitted] main
main.iframe.bundle.js.map 43 KiB main [emitted] [dev] main
runtime~main.iframe.bundle.js 37.9 KiB runtime~main [emitted] runtime~main
runtime~main.iframe.bundle.js.map 39.2 KiB runtime~main [emitted] [dev] runtime~main
static/media/code-brackets.2e1112d7.svg 1.42 KiB [emitted] [immutable]
static/media/colors.a4bd0486.svg 8.31 KiB [emitted] [immutable]
static/media/comments.a3859089.svg 1.49 KiB [emitted] [immutable]
static/media/direction.b770f9af.svg 1.25 KiB [emitted] [immutable]
static/media/flow.edad2ac1.svg 1.36 KiB [emitted] [immutable]
static/media/plugin.d494b228.svg 2.12 KiB [emitted] [immutable]
static/media/repo.6d496322.svg 1.6 KiB [emitted] [immutable]
static/media/stackalt.dba9fbb3.svg 2.49 KiB [emitted] [immutable]
vendors~main.iframe.bundle.js 4.64 MiB vendors~main [emitted] [big] vendors~main
vendors~main.iframe.bundle.js.map 4.16 MiB vendors~main [emitted] [dev] vendors~main
Entrypoint main [big] = runtime~main.iframe.bundle.js runtime~main.iframe.bundle.js.map vendors~main.iframe.bundle.js vendors~main.iframe.bundle.js.map main.iframe.bundle.js main.iframe.bundle.js.map
[0] multi ./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js ./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ErrorOverlayEntry.js ./node_modules/#storybook/core-client/dist/esm/globals/polyfills.js ./node_modules/#storybook/core-client/dist/esm/globals/globals.js (webpack)-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined ./storybook-init-framework-entry.js ./node_modules/#storybook/addon-docs/dist/esm/frameworks/common/config.js-generated-config-entry.js ./node_modules/#storybook/addon-docs/dist/esm/frameworks/react/config.js-generated-config-entry.js ./node_modules/#storybook/react/dist/esm/client/preview/config-generated-config-entry.js ./node_modules/#storybook/addon-links/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-backgrounds/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-backgrounds/dist/esm/preset/addParameter.js-generated-config-entry.js ./node_modules/#storybook/addon-measure/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-outline/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-actions/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-actions/dist/esm/preset/addArgs.js-generated-config-entry.js ./.storybook/preview.js-generated-config-entry.js ./generated-stories-entry.js 232 bytes {main} [built]
[./.storybook/preview.js-generated-config-entry.js] 3.91 KiB {main} [built] [failed] [1 error]
[./generated-stories-entry.js] 2.95 KiB {main} [built]
[./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ErrorOverlayEntry.js] 2.38 KiB {vendors~main} [built]
[./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js] 500 bytes {vendors~main} [built]
[./node_modules/#storybook/addon-actions/dist/esm/preset/addArgs.js-generated-config-entry.js] 699 bytes {vendors~main} [built] [failed] [1 error]
[./node_modules/#storybook/addon-actions/dist/esm/preset/addDecorator.js-generated-config-entry.js] 704 bytes {vendors~main} [built] [failed] [1 error]
[./node_modules/#storybook/addon-backgrounds/dist/esm/preset/addDecorator.js-generated-config-entry.js] 708 bytes {vendors~main} [built] [failed] [1 error]
[./node_modules/#storybook/addon-backgrounds/dist/esm/preset/addParameter.js-generated-config-entry.js] 708 bytes {vendors~main} [built] [failed] [1 error]
[./node_modules/#storybook/addon-docs/dist/esm/frameworks/common/config.js-generated-config-entry.js] 706 bytes {vendors~main} [built] [failed] [1 error][./node_modules/#storybook/addon-docs/dist/esm/frameworks/react/config.js-generated-config-entry.js] 705 bytes {vendors~main} [built] [failed] [1 error]
[./node_modules/#storybook/addon-links/dist/esm/preset/addDecorator.js-generated-config-entry.js] 702 bytes {vendors~main} [built] [failed] [1 error]
[./node_modules/#storybook/addon-measure/dist/esm/preset/addDecorator.js-generated-config-entry.js] 704 bytes {vendors~main} [built] [failed] [1 error]
[./node_modules/#storybook/addon-outline/dist/esm/preset/addDecorator.js-generated-config-entry.js] 704 bytes {vendors~main} [built] [failed] [1 error]
[./node_modules/#storybook/core-client/dist/esm/globals/globals.js] 105 bytes {vendors~main} [built]
+ 1184 hidden modules
ERROR in ./.storybook/preview.js-generated-config-entry.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: D:\311's learning\learn-storybook-5\.storybook\preview.js-generated-config-entry.js: Missing semicolon. (8:118)
6 |
7 | /* eslint-disable import/no-unresolved */
> 8 | import { addDecorator, addParameters, addLoader, addArgsEnhancer, addArgTypesEnhancer, setGlobalRender } from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/client-api';
| ^
9 | import { logger } from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/client-logger';
10 | import * as config from 'D:/311's learning/learn-storybook-5/.storybook/preview.js';
11 | Object.keys(config).forEach(function (key) {
at Object._raise (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:541:17)
at Object.raiseWithData (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:534:17)
at Object.raise (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:495:17)
at Object.semicolon (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:3550:10)
at Object.parseImport (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:14831:10)
at Object.parseStatementContent (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13454:27)
at Object.parseStatement (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13352:17)
at Object.parseStatement (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:5307:24)
at Object.parseBlockOrModuleBlockBody (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13941:25)
at Object.parseBlockBody (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13932:10)
at Object.parseProgram (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13272:10)
at Object.parseTopLevel (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13263:25)
at Object.parseTopLevel (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:6273:28)
at Object.parse (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:15037:10)
at parse (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:15089:38)
at parser (D:\311's learning\learn-storybook-5\node_modules\#babel\core\lib\parser\index.js:52:34)
# multi ./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js ./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ErrorOverlayEntry.js ./node_modules/#storybook/core-client/dist/esm/globals/polyfills.js ./node_modules/#storybook/core-client/dist/esm/globals/globals.js (webpack)-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined ./storybook-init-framework-entry.js ./node_modules/#storybook/addon-docs/dist/esm/frameworks/common/config.js-generated-config-entry.js ./node_modules/#storybook/addon-docs/dist/esm/frameworks/react/config.js-generated-config-entry.js ./node_modules/#storybook/react/dist/esm/client/preview/config-generated-config-entry.js ./node_modules/#storybook/addon-links/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-backgrounds/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-backgrounds/dist/esm/preset/addParameter.js-generated-config-entry.js ./node_modules/#storybook/addon-measure/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-outline/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-actions/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-actions/dist/esm/preset/addArgs.js-generated-config-entry.js ./.storybook/preview.js-generated-config-entry.js ./generated-stories-entry.js main[16]
ERROR in ./node_modules/#storybook/addon-actions/dist/esm/preset/addArgs.js-generated-config-entry.js 8:118
Module parse failed: Unexpected token (8:118)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| /* eslint-disable import/no-unresolved */
> import { addDecorator, addParameters, addLoader, addArgsEnhancer, addArgTypesEnhancer, setGlobalRender } from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/client-api';
| import { logger } from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/client-logger';
| import * as config from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/addon-actions/dist/esm/preset/addArgs.js';
# multi ./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js ./node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ErrorOverlayEntry.js ./node_modules/#storybook/core-client/dist/esm/globals/polyfills.js ./node_modules/#storybook/core-client/dist/esm/globals/globals.js (webpack)-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined ./storybook-init-framework-entry.js ./node_modules/#storybook/addon-docs/dist/esm/frameworks/common/config.js-generated-config-entry.js ./node_modules/#storybook/addon-docs/dist/esm/frameworks/react/config.js-generated-config-entry.js ./node_modules/#storybook/react/dist/esm/client/preview/config-generated-config-entry.js ./node_modules/#storybook/addon-links/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-backgrounds/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-backgrounds/dist/esm/preset/addParameter.js-generated-config-entry.js ./node_modules/#storybook/addon-measure/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-outline/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-actions/dist/esm/preset/addDecorator.js-generated-config-entry.js ./node_modules/#storybook/addon-actions/dist/esm/preset/addArgs.js-generated-config-entry.js ./.storybook/preview.js-generated-config-entry.js ./generated-stories-entry.js main[15]
Child HtmlWebpackCompiler:
Asset Size Chunks Chunk Names
__child-HtmlWebpackPlugin_0 6.28 KiB HtmlWebpackPlugin_0 HtmlWebpackPlugin_0
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/#storybook/core-common/dist/cjs/templates/index.ejs] 2.03 KiB {HtmlWebpackPlugin_0}
[built]
ModuleBuildError: Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: D:\311's learning\learn-storybook-5\.storybook\preview.js-generated-config-entry.js: Missing semicolon. (8:118)
6 |
7 | /* eslint-disable import/no-unresolved */
> 8 | import { addDecorator, addParameters, addLoader, addArgsEnhancer, addArgTypesEnhancer, setGlobalRender } from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/client-api';
| ^
9 | import { logger } from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/client-logger';
10 | import * as config from 'D:/311's learning/learn-storybook-5/.storybook/preview.js';
11 | Object.keys(config).forEach(function (key) {
at Object._raise (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:541:17)
at Object.raiseWithData (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:534:17)
at Object.raise (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:495:17)
at Object.semicolon (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:3550:10)
at Object.parseImport (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:14831:10)
at Object.parseStatementContent (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13454:27)
at Object.parseStatement (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13352:17)
at Object.parseStatement (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:5307:24)
at Object.parseBlockOrModuleBlockBody (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13941:25)
at Object.parseBlockBody (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13932:10)
at Object.parseProgram (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13272:10)
at Object.parseTopLevel (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:13263:25)
at Object.parseTopLevel (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:6273:28)
at Object.parse (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:15037:10)
at parse (D:\311's learning\learn-storybook-5\node_modules\#babel\parser\lib\index.js:15089:38)
at parser (D:\311's learning\learn-storybook-5\node_modules\#babel\core\lib\parser\index.js:52:34)
at D:\311's learning\learn-storybook-5\node_modules\webpack\lib\NormalModule.js:316:20
at D:\311's learning\learn-storybook-5\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at D:\311's learning\learn-storybook-5\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (D:\311's learning\learn-storybook-5\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at D:\311's learning\learn-storybook-5\node_modules\babel-loader\lib\index.js:59:103
ModuleParseError: Module parse failed: Unexpected token (8:118)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| /* eslint-disable import/no-unresolved */
> import { addDecorator, addParameters, addLoader, addArgsEnhancer, addArgTypesEnhancer, setGlobalRender } from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/client-api';
| import { logger } from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/client-logger';
| import * as config from 'D:/311's learning/learn-storybook-5/node_modules/#storybook/addon-actions/dist/esm/preset/addArgs.js';
at handleParseError (D:\311's learning\learn-storybook-5\node_modules\webpack\lib\NormalModule.js:469:19)
at D:\311's learning\learn-storybook-5\node_modules\webpack\lib\NormalModule.js:503:5
at D:\311's learning\learn-storybook-5\node_modules\webpack\lib\NormalModule.js:358:12
at D:\311's learning\learn-storybook-5\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\311's learning\learn-storybook-5\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at D:\311's learning\learn-storybook-5\node_modules\loader-runner\lib\LoaderRunner.js:205:4
at D:\311's learning\learn-storybook-5\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:85:15
at processTicksAndRejections (node:internal/process/task_queues:78:11)
WARN Broken build, fix the error above.
WARN You may need to refresh the browser.
I searched with possible keywords from the error on google and in-and-out stack-overflow links. I installed some addon in .storybook/main.js file. But nothing works. Below are my package.json file and two config file of storybook.
//package.json
{
"name": "learn-storybook-5",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.16.1",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "^4.0.3",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -s public"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
],
"overrides": [
{
"files": [
"**/*.stories.*"
],
"rules": {
"import/no-anonymous-default-export": "off"
}
}
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#storybook/addon-actions": "^6.4.9",
"#storybook/addon-docs": "^6.4.9",
"#storybook/addon-essentials": "^6.4.9",
"#storybook/addon-links": "^6.4.9",
"#storybook/node-logger": "^6.4.9",
"#storybook/preset-create-react-app": "^3.2.0",
"#storybook/react": "^6.4.9"
}
}
//.storybook/main.js
module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.#(js|jsx|ts|tsx)'],
addons: [
'#storybook/addon-links',
'#storybook/addon-essentials',
'#storybook/preset-create-react-app',
'#storybook/addon-actions',
'#storybook/node-logger',
'#storybook/addon-docs',
],
framework: '#storybook/react',
}
//.storybook/preview.js
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
It has been two days that I can't even boost up stroybook :))
I hope someone could guide me.
The problem was my folder name 3ll's learning.
The single quote from my folder name conflicts with paths used in Stroybook's modules. That's it. Admin from Storybook discord server pointed out that to me.

CopyWebpackPlugin isn't copying static files to output directory

My files show as being emitted but they are not actually being copied to dist folder.
Excerpt of compilation log:
Version: webpack 4.15.1 Time: 1824ms Built at: 01/29/2020 3:51:51 PM
Asset Size Chunks Chunk Names
main.js 116 KiB 0 [emitted] main
CSS/main.css 76 bytes [emitted] Images/Uplink_Logo_Horiz.jpg 651 KiB [emitted] [big]
CSS/adminlte.css 708 KiB [emitted] [big]
index.html 6.7 KiB [emitted]
And my webpack config plugin looks like this:
plugins: [
new CopyWebpackPlugin([
{
from: './Images/**',
to: path.join(__dirname, 'dist'),
logLevel: 'trace'
},
{
from: './CSS/**',
to: path.join(__dirname, 'dist'),
logLevel: 'trace'
}
]),
new HtmlWebpackPlugin({
template: './src/index.html'
})
],
I tried changing the order of CopyWebpackPlugin & HtmlWebpackPlugin to no luck. Did you do any other thing to solve this other than just changing the order.
Versions:
"vue": "^2.6.11", "webpack": "^4.15.0", "webpack-cli": "^3.0.8",
"copy-webpack-plugin": "^5.1.1", "html-webpack-plugin": "^3.2.0",
Updated Image:
Full project structure:
Found out the issue. The static files were not included in the VS project. Once I included them it started working. Thanks, for the help :)

Heroku build error while deploying MEVN app, why is heroku showing babel-loader and vue-loader errors?

I have been facing issues while deploying my MEVN application to Heroku. I googled the error but couldn't find anything, please help me I'm new to webpack and Heroku. I have created my Vue project using vue init webpack client and I had my server implemented in a different folder (server), since Heroku needs build scripts, I merged package.json files of client and server folder and I have updated my package-lock.json file after that by npm update. But I still get this error:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): >= 6.0.0
engines.npm (package.json): >= 3.0.0
Resolving node version >= 6.0.0...
Downloading and installing node 13.6.0...
Bootstrapping npm >= 3.0.0 (replacing 6.13.4)...
npm >= 3.0.0 installed
-----> Installing dependencies
Installing node modules (package.json + package-lock)
> chromedriver#2.46.0 install /tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/chromedriver
> node install.js
Current existing ChromeDriver binary is unavailable, proceding with download and extraction.
Downloading from file: https://chromedriver.storage.googleapis.com/2.46/chromedriver_linux64.zip
Saving to file: /tmp/2.46/chromedriver/chromedriver_linux64.zip
Received 781K...
Received 1568K...
Received 2352K...
Received 3136K...
Received 3920K...
Received 4704K...
Received 5277K total.
Extracting zip contents
Copying to target path /tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/chromedriver/lib/chromedriver
Fixing file permissions
Done. ChromeDriver binary available at /tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/chromedriver/lib/chromedriver/chromedriver
> fibers#4.0.2 install /tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/fibers
> node build.js || nodejs build.js
make: Entering directory '/tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/fibers/build'
CXX(target) Release/obj.target/fibers/src/fibers.o
CXX(target) Release/obj.target/fibers/src/coroutine.o
CC(target) Release/obj.target/fibers/src/libcoro/coro.o
SOLINK_MODULE(target) Release/obj.target/fibers.node
COPY Release/fibers.node
make: Leaving directory '/tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/fibers/build'
Installed in `/tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/fibers/bin/linux-x64-79-glibc/fibers.node`
> core-js#2.6.11 postinstall /tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> uglifyjs-webpack-plugin#0.4.6 postinstall /tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
> nodemon#2.0.2 postinstall /tmp/build_2fcae940471da78ab872bed7c7ce5e39/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
added 1669 packages from 1080 contributors and audited 13491 packages in 48.871s
29 packages are looking for funding
run `npm fund` for details
found 23 vulnerabilities (2 low, 8 moderate, 12 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
-----> Build
Running build
> HeideParkTour#1.0.0 build /tmp/build_2fcae940471da78ab872bed7c7ce5e39
> node client/build/build.js
Hash: 1f676cbf14c73a4ac7d7
Version: webpack 3.12.0
Time: 44077ms
Asset Size Chunks Chunk Names
static/fonts/materialdesignicons-webfont.1618c77.ttf 808 kB [emitted] [big]
static/fonts/materialdesignicons-webfont.f81583f.eot 809 kB [emitted] [big]
static/fonts/materialdesignicons-webfont.927457e.woff2 269 kB [emitted] [big]
static/fonts/materialdesignicons-webfont.d6e3eba.woff 387 kB [emitted] [big]
static/img/HPTlogo.6c94a57.png 12.5 kB [emitted]
static/img/heide_park1.da1efef.jpg 242 kB [emitted]
static/img/heide_park2.b4ddd09.jpg 46.5 kB [emitted]
static/img/map.295e335.jpg 257 kB [emitted] [big]
static/js/vendor.9006eec36c308de31372.js 1.19 MB 0 [emitted] [big] vendor
static/js/app.63a04543eebdeaf1c83f.js 34.8 kB 1 [emitted] app
static/js/manifest.2ae2e69a05c33dfc65f8.js 857 bytes 2 [emitted] manifest
static/css/app.d1eaa4d455ed63d9598ae1f65cf611eb.css 740 kB 1 [emitted] [big] app
static/css/app.d1eaa4d455ed63d9598ae1f65cf611eb.css.map 1.08 MB [emitted]
static/js/vendor.9006eec36c308de31372.js.map 4.15 MB 0 [emitted] vendor
static/js/app.63a04543eebdeaf1c83f.js.map 89 kB 1 [emitted] app
static/js/manifest.2ae2e69a05c33dfc65f8.js.map 4.97 kB 2 [emitted] manifest
index.html 800 bytes [emitted]
static/favicon.png 29.9 kB [emitted]
ERROR in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./client/src/views/HomePage.vue
Module not found: Error: Can't resolve '../components/homepage/welcomeInfo' in '/tmp/build_2fcae940471da78ab872bed7c7ce5e39/client/src/views'
# ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./client/src/views/HomePage.vue 17:0-61
# ./client/src/views/HomePage.vue
# ./client/src/router/index.js
# ./client/src/main.js
Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! HeideParkTour#1.0.0 build: `node client/build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the HeideParkTour#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.bH7SD/_logs/2020-01-16T22_49_23_712Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Dangerous semver range (>) in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
I don't understand what's with vue loader and babel loader. I tried putting vue-loader and babel-loader in dependencies instead of dev-dependencies, It didn't work. Here's my package.json file:
{
"name": "HeideParkTour",
"version": "1.0.0",
"description": "Heide Park Tour webapp",
"author": "stu218608#mail.uni-kiel.de",
"main": "index.js",
"scripts": {
"dev": "concurrently \"nodemon app.js\" \"npm run dev-client\"",
"dev-client": "webpack-dev-server --inline --hot --config client/build/webpack.dev.conf.js",
"start": "nodemon app.js",
"build": "node client/build/build.js",
"e2e": "node client/test/e2e/runner.js",
"test": "npm run e2e",
"lint": "eslint --ext .js,.vue src client/test/e2e/specs"
},
"keywords": [],
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"concurrently": "^5.0.2",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.7.14",
"morgan": "^1.9.1",
"nodemon": "^2.0.1",
"shelljs": "^0.8.3",
"axios": "^0.19.0",
"leaflet": "^1.6.0",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vue2-leaflet": "^2.4.1",
"vuetify": "^2.1.15",
"vuex": "^3.1.2",
"vuex-persistedstate": "^2.7.0"
},
"devDependencies": {
"#mdi/font": "^4.7.95",
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^8.2.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"chromedriver": "^2.27.2",
"copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^5.0.1",
"css-loader": "^0.28.0",
"deepmerge": "^4.2.2",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"extract-text-webpack-plugin": "^3.0.0",
"fibers": "^4.0.2",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"nightwatch": "^0.9.12",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"sass": "^1.24.0",
"sass-loader": "^8.0.0",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
This is my project structure:
|---app.js
|
├───client
│ ├───build
│ ├───config
│ ├───src
│ │ ├───assets
│ │ │ └───Intro-Page
│ │ ├───components
│ │ │ ├───common
│ │ │ ├───homepage
│ │ │ └───posts
│ │ ├───router
│ │ ├───services
│ │ ├───store
│ │ │ └───modules
│ │ └───views
│ ├───static
│ └───test
│ └───e2e
│ ├───custom-assertions
│ └───specs
└───server
├───config
├───controllers
├───models
├───public
│ └───static
│ ├───css
│ ├───fonts
│ ├───img
│ └───js
└───routes
I have also set up the env variable by this command heroku config:set NODE_ENV=production --app heide-park-tour but It doesn't seem to work. I'm not sure if this error is caused because of merging package.json files from client and server, but please I'm out of options now :(.
Well it turns out the issue here is with filename, I feel so embarrassed🙈. Back when I created Vue project, I named my components with starting letter capitalized and later I decided to name my components with small letters. I changed it locally but then GitHub repo won't change the components name.
for eg. you have foobar.vue locally and GitHub repo has 'Foobar.vue`, GitHub will ignore the filename change.
I'm not really sure, but I figured out that, Heroku while deploying pulls project from Github repo. So it was not able to find my components "welcomeInfo" and "carousel" which were "WelcomeInfo" and "Carousel" in the remote repos.

Which dependencies do I need to add when publishing a vue component to npm?

I have built a vue component that I want to publish to npm (already did so), but I was wondering if I need to add vue as dependency and if that will affect the size of the component. Currently my package.json looks like this
"dependencies": {
"vue": "^2.6.6",
"vue-svg-loader": "^0.12.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "^3.0.5",
"#vue/cli-plugin-eslint": "^3.0.5",
"#vue/cli-service": "^3.0.5",
"babel-eslint": "^10.0.1",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.5.21"
},
I'm using the vue-cli-service to build my component with the following command
vue-cli-service build --target lib --name my_component_name ./src/index.js
I had the feeling that for the fairly small component I am building, the bundle size is relativly big
This is my output:
File | Size | Gzipped
dist\my_component.umd.min.js | 61.67 KiB | 18.62 KiB
dist\my_component.umd.js | 143.66 KiB | 32.61 KiB
dist\my_component.common.js | 143.27 KiB | 32.49 KiB
So - long story short: I was wondering if the dependency on vue will increase my bundle size and if it is actually required as dependency when publishing a single component.