Dev & Production script is being generated but html is unable to pick the latest js file









up vote
0
down vote

favorite












I am using webpack 4 to generate app.js and app.min.js files from index.js and i am using app.min.js script in HTML. I am not using webpack.config.js file for this. I am using scripts.



My package.json scripts are these:



"build:dev": "webpack --mode development --module-bind js=babel-loader ./src/index.js --output ./dist/scripts/app.js",
"build:prod": "webpack --mode production --module-bind js=babel-loader ./src/index.js --output ./dist/scripts/app.min.js",
"build:process": "npm-run-all build:dev build:prod"


And I have .babelrc file that contains following:




"presets": [
"@babel/preset-env"
]



I am not sure my script is using babel-core or @babel/preset-env or @babel/core or babel-core or babel-preset-env but I have these in my dependencies list.



My dependencies are below:



 "dependencies": 
"babel-polyfill": "^6.26.0"
,
"devDependencies":
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"autoprefixer": "^9.3.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.4",
"babel-minify-webpack-plugin": "^0.3.1",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"body-parser": "^1.18.3",
"browser-sync": "^2.26.3",
"compression": "^1.7.3",
"cross-env": "^5.2.0",
"css-loader": "^1.0.1",
"csv-loader": "^3.0.2",
"eslint": "^5.9.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.14.0",
"express": "^4.16.4",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"jsdom": "^13.0.0",
"localtunnel": "^1.9.1",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.10.0",
"nodemon": "^1.18.6",
"npm-run-all": "^4.1.3",
"postcss-cli": "^6.0.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"uglify-js": "^3.4.9",
"uglifyjs-folder": "^1.5.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"url-loader": "^1.1.2",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2",
"webpack-dev-middleware": "^3.4.0",
"webpack-dev-server": "^3.1.10",
"webpack-hot-middleware": "^2.24.3",
"xml-loader": "^1.2.1"



I am generating app.js and app.min.js from index.js
The files are being generated and if i change code in index.js it gets updated in output files but in html page where I have called it like



<script src="assets/scripts/app.min.js"></script>


Its not getting updated and is loading old code. I am looking at same code output after every new production build even though its being changed in the app.min.js on every build run.



If I use these scripts:



"build:dev": "webpack --mode development"
"build:prod": "webpack --mode production"


Than main.js is generated and if i call that main.js in html it reflects changes on each build request.



Its a simple JS environment - no framework - I am using Yarn. I have tried deleting app.js and app.min.js files. I have run 'yarn upgraded' and 'yarn clean' and 'yarn audit fix' but same result.



So why i am unable to see changes in app.min.js on each build if i try to change entry and output points? And I am not using any server or localhost. just opening index.html that has the app.min.js included.



The script url is here, in case anybody wants to have a look at whole script:
https://github.com/techmynd/Webpack/tree/master/0-webpack-4/via-scripts










share|improve this question























  • ahh. It was path issue. I forgot to set the correct path ./dist/assets/scripts/ instead of ./dist/scripts/ - its working now.
    – Hiroshi Rana
    Nov 11 at 12:25














up vote
0
down vote

favorite












I am using webpack 4 to generate app.js and app.min.js files from index.js and i am using app.min.js script in HTML. I am not using webpack.config.js file for this. I am using scripts.



My package.json scripts are these:



"build:dev": "webpack --mode development --module-bind js=babel-loader ./src/index.js --output ./dist/scripts/app.js",
"build:prod": "webpack --mode production --module-bind js=babel-loader ./src/index.js --output ./dist/scripts/app.min.js",
"build:process": "npm-run-all build:dev build:prod"


And I have .babelrc file that contains following:




"presets": [
"@babel/preset-env"
]



I am not sure my script is using babel-core or @babel/preset-env or @babel/core or babel-core or babel-preset-env but I have these in my dependencies list.



My dependencies are below:



 "dependencies": 
"babel-polyfill": "^6.26.0"
,
"devDependencies":
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"autoprefixer": "^9.3.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.4",
"babel-minify-webpack-plugin": "^0.3.1",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"body-parser": "^1.18.3",
"browser-sync": "^2.26.3",
"compression": "^1.7.3",
"cross-env": "^5.2.0",
"css-loader": "^1.0.1",
"csv-loader": "^3.0.2",
"eslint": "^5.9.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.14.0",
"express": "^4.16.4",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"jsdom": "^13.0.0",
"localtunnel": "^1.9.1",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.10.0",
"nodemon": "^1.18.6",
"npm-run-all": "^4.1.3",
"postcss-cli": "^6.0.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"uglify-js": "^3.4.9",
"uglifyjs-folder": "^1.5.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"url-loader": "^1.1.2",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2",
"webpack-dev-middleware": "^3.4.0",
"webpack-dev-server": "^3.1.10",
"webpack-hot-middleware": "^2.24.3",
"xml-loader": "^1.2.1"



I am generating app.js and app.min.js from index.js
The files are being generated and if i change code in index.js it gets updated in output files but in html page where I have called it like



<script src="assets/scripts/app.min.js"></script>


Its not getting updated and is loading old code. I am looking at same code output after every new production build even though its being changed in the app.min.js on every build run.



If I use these scripts:



"build:dev": "webpack --mode development"
"build:prod": "webpack --mode production"


Than main.js is generated and if i call that main.js in html it reflects changes on each build request.



Its a simple JS environment - no framework - I am using Yarn. I have tried deleting app.js and app.min.js files. I have run 'yarn upgraded' and 'yarn clean' and 'yarn audit fix' but same result.



So why i am unable to see changes in app.min.js on each build if i try to change entry and output points? And I am not using any server or localhost. just opening index.html that has the app.min.js included.



The script url is here, in case anybody wants to have a look at whole script:
https://github.com/techmynd/Webpack/tree/master/0-webpack-4/via-scripts










share|improve this question























  • ahh. It was path issue. I forgot to set the correct path ./dist/assets/scripts/ instead of ./dist/scripts/ - its working now.
    – Hiroshi Rana
    Nov 11 at 12:25












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am using webpack 4 to generate app.js and app.min.js files from index.js and i am using app.min.js script in HTML. I am not using webpack.config.js file for this. I am using scripts.



My package.json scripts are these:



"build:dev": "webpack --mode development --module-bind js=babel-loader ./src/index.js --output ./dist/scripts/app.js",
"build:prod": "webpack --mode production --module-bind js=babel-loader ./src/index.js --output ./dist/scripts/app.min.js",
"build:process": "npm-run-all build:dev build:prod"


And I have .babelrc file that contains following:




"presets": [
"@babel/preset-env"
]



I am not sure my script is using babel-core or @babel/preset-env or @babel/core or babel-core or babel-preset-env but I have these in my dependencies list.



My dependencies are below:



 "dependencies": 
"babel-polyfill": "^6.26.0"
,
"devDependencies":
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"autoprefixer": "^9.3.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.4",
"babel-minify-webpack-plugin": "^0.3.1",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"body-parser": "^1.18.3",
"browser-sync": "^2.26.3",
"compression": "^1.7.3",
"cross-env": "^5.2.0",
"css-loader": "^1.0.1",
"csv-loader": "^3.0.2",
"eslint": "^5.9.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.14.0",
"express": "^4.16.4",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"jsdom": "^13.0.0",
"localtunnel": "^1.9.1",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.10.0",
"nodemon": "^1.18.6",
"npm-run-all": "^4.1.3",
"postcss-cli": "^6.0.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"uglify-js": "^3.4.9",
"uglifyjs-folder": "^1.5.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"url-loader": "^1.1.2",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2",
"webpack-dev-middleware": "^3.4.0",
"webpack-dev-server": "^3.1.10",
"webpack-hot-middleware": "^2.24.3",
"xml-loader": "^1.2.1"



I am generating app.js and app.min.js from index.js
The files are being generated and if i change code in index.js it gets updated in output files but in html page where I have called it like



<script src="assets/scripts/app.min.js"></script>


Its not getting updated and is loading old code. I am looking at same code output after every new production build even though its being changed in the app.min.js on every build run.



If I use these scripts:



"build:dev": "webpack --mode development"
"build:prod": "webpack --mode production"


Than main.js is generated and if i call that main.js in html it reflects changes on each build request.



Its a simple JS environment - no framework - I am using Yarn. I have tried deleting app.js and app.min.js files. I have run 'yarn upgraded' and 'yarn clean' and 'yarn audit fix' but same result.



So why i am unable to see changes in app.min.js on each build if i try to change entry and output points? And I am not using any server or localhost. just opening index.html that has the app.min.js included.



The script url is here, in case anybody wants to have a look at whole script:
https://github.com/techmynd/Webpack/tree/master/0-webpack-4/via-scripts










share|improve this question















I am using webpack 4 to generate app.js and app.min.js files from index.js and i am using app.min.js script in HTML. I am not using webpack.config.js file for this. I am using scripts.



My package.json scripts are these:



"build:dev": "webpack --mode development --module-bind js=babel-loader ./src/index.js --output ./dist/scripts/app.js",
"build:prod": "webpack --mode production --module-bind js=babel-loader ./src/index.js --output ./dist/scripts/app.min.js",
"build:process": "npm-run-all build:dev build:prod"


And I have .babelrc file that contains following:




"presets": [
"@babel/preset-env"
]



I am not sure my script is using babel-core or @babel/preset-env or @babel/core or babel-core or babel-preset-env but I have these in my dependencies list.



My dependencies are below:



 "dependencies": 
"babel-polyfill": "^6.26.0"
,
"devDependencies":
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"autoprefixer": "^9.3.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.4",
"babel-minify-webpack-plugin": "^0.3.1",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"body-parser": "^1.18.3",
"browser-sync": "^2.26.3",
"compression": "^1.7.3",
"cross-env": "^5.2.0",
"css-loader": "^1.0.1",
"csv-loader": "^3.0.2",
"eslint": "^5.9.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.14.0",
"express": "^4.16.4",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"jsdom": "^13.0.0",
"localtunnel": "^1.9.1",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.10.0",
"nodemon": "^1.18.6",
"npm-run-all": "^4.1.3",
"postcss-cli": "^6.0.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"uglify-js": "^3.4.9",
"uglifyjs-folder": "^1.5.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"url-loader": "^1.1.2",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2",
"webpack-dev-middleware": "^3.4.0",
"webpack-dev-server": "^3.1.10",
"webpack-hot-middleware": "^2.24.3",
"xml-loader": "^1.2.1"



I am generating app.js and app.min.js from index.js
The files are being generated and if i change code in index.js it gets updated in output files but in html page where I have called it like



<script src="assets/scripts/app.min.js"></script>


Its not getting updated and is loading old code. I am looking at same code output after every new production build even though its being changed in the app.min.js on every build run.



If I use these scripts:



"build:dev": "webpack --mode development"
"build:prod": "webpack --mode production"


Than main.js is generated and if i call that main.js in html it reflects changes on each build request.



Its a simple JS environment - no framework - I am using Yarn. I have tried deleting app.js and app.min.js files. I have run 'yarn upgraded' and 'yarn clean' and 'yarn audit fix' but same result.



So why i am unable to see changes in app.min.js on each build if i try to change entry and output points? And I am not using any server or localhost. just opening index.html that has the app.min.js included.



The script url is here, in case anybody wants to have a look at whole script:
https://github.com/techmynd/Webpack/tree/master/0-webpack-4/via-scripts







babel webpack-4 babel-loader






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 12:17

























asked Nov 11 at 1:52









Hiroshi Rana

3232313




3232313











  • ahh. It was path issue. I forgot to set the correct path ./dist/assets/scripts/ instead of ./dist/scripts/ - its working now.
    – Hiroshi Rana
    Nov 11 at 12:25
















  • ahh. It was path issue. I forgot to set the correct path ./dist/assets/scripts/ instead of ./dist/scripts/ - its working now.
    – Hiroshi Rana
    Nov 11 at 12:25















ahh. It was path issue. I forgot to set the correct path ./dist/assets/scripts/ instead of ./dist/scripts/ - its working now.
– Hiroshi Rana
Nov 11 at 12:25




ahh. It was path issue. I forgot to set the correct path ./dist/assets/scripts/ instead of ./dist/scripts/ - its working now.
– Hiroshi Rana
Nov 11 at 12:25

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245170%2fdev-production-script-is-being-generated-but-html-is-unable-to-pick-the-latest%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245170%2fdev-production-script-is-being-generated-but-html-is-unable-to-pick-the-latest%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto