webpack bundles files but index.js isn't runningHow can I upload files asynchronously?How do I include a JavaScript file in another JavaScript file?Managing jQuery plugin dependency in webpackHow to bundle vendor scripts separately and require them as needed with Webpack?NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. WebpackES6 import using at ('@') sign in path in a vue.js project using WebpackWebpack fails to find module dirsHow to fix HTML file comments not being ignored by Webpack Dev Server?Webpack css issue, missing bundle.cssUsing webpack-dev-server 3 with parallel-webpack

Why does it seem the best way to make a living is to invest in real estate?

Did the Soviet army intentionally send troops (e.g. penal battalions) running over minefields?

Airport Security - advanced check, 4th amendment breach

What action is recommended if your accommodation refuses to let you leave without paying additional fees?

What is the difference between increasing volume and increasing gain?

Citing CPLEX 12.9

Why do personal finance apps focus on outgoings rather than income

Bothered by watching coworkers slacking off

Why is there such a singular place for bird watching?

How to refresh wired service getRecord manually?

If I travelled back in time to invest in X company to make a fortune, roughly what is the probability that it would fail?

Notation clarity question for a conglomerate of accidentals

Is "weekend warrior" derogatory?

Is there an in-universe explanation of how Frodo's arrival in Valinor was recorded in the Red Book?

Can Fabled Passage generate two mana with Amulet of Vigor?

The answer is a girl's name (my future granddaughter) - can anyone help?

How is this situation not a checkmate?

How to protect bash function from being overridden?

Is it appropriate to "shop" through high-impact journals before sending the paper to more specialized journals?

Can I bring this power bank on board the aircraft?

What did the Federation give the Prophets in exchange for access to the wormhole in DS9?

Do jackscrews suffer from blowdown?

Ĉi tie or ĉi-tie? Why do people sometimes hyphenate ĉi tie?

How to level a picture frame hung on a single nail?



webpack bundles files but index.js isn't running


How can I upload files asynchronously?How do I include a JavaScript file in another JavaScript file?Managing jQuery plugin dependency in webpackHow to bundle vendor scripts separately and require them as needed with Webpack?NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. WebpackES6 import using at ('@') sign in path in a vue.js project using WebpackWebpack fails to find module dirsHow to fix HTML file comments not being ignored by Webpack Dev Server?Webpack css issue, missing bundle.cssUsing webpack-dev-server 3 with parallel-webpack






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









3















I have an index.js file that imports my CSS and a few packages, but after bundling everything and starting the server I noticed that index.js wasn't running. I did a simple console.log in index.js and it isn't reached.



I copied the contents of my webpack.config file from a previous project which was working correctly, so I'm not sure if it's a file structure/path error or what not. Any thoughts?



Directory structure:



enter image description here



webpack.config.js:



const path = require('path')
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin')
var $ = require("jquery");

var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
template: './src/index.html',
filename: 'RecruitmentTracking.txt',
inject: 'body'
);

module.exports =
entry: "./src/index.js", // removing the . fails the build
output:
filename: './SiteAssets/scripts/RecruitmentTracking.js',
path: path.resolve(__dirname, 'dist')
,

module:
rules: [
loader: 'babel-loader',
test: /.js$/,
exclude: /node_modules/
,
test: /.css$/,
use: ['style-loader', 'css-loader']
,
test: /.(png
],
,
devServer:
disableHostCheck: true
,
devtool: 'cheap-module-eval-source-map', // this helps to browser to point to the exact file in the console, helps in debug
devServer:
contentBase: path.join(__dirname, 'src'),
historyApiFallback: true // this prevents the default browser full page refresh on form submission and link change
,
plugins: [
HtmlWebpackPluginConfig,
new webpack.ProvidePlugin(
"$": "jquery",
"jQuery": "jquery",
"window.jQuery": "jquery"
)]



index.js:



import "./RecruitmentTracking.css";
import 'jquery';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
import 'jquery-ui-bundle/jquery-ui.min.js';

console.log('this is index.js');


package.json:




"name": "recruitmenttracking",
"version": "1.0.0",
"description": "Recruitment Initiatives Tracking",
"main": "index.js", // ----- should a more specific file path be here?
"scripts":
"test": "echo "Error: no test specified" && exit 1",
"start": "webpack-dev-server --open --mode development",
"build": "webpack --config webpack.config.js",
"dev-server": "webpack-dev-server"
,
"author": "",
"license": "ISC",
"devDependencies":
"@babel/cli": "^7.2.3",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"style-loader": "^0.23.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
,
"dependencies":
"@babel/polyfill": "^7.4.0",
"axios": "^0.18.0",
"bootstrap": "^4.3.1",
"jquery": "^3.3.1",
"jquery-ui-bundle": "^1.12.1-migrate",
"pdfmake": "^0.1.54",
"popper": "^1.0.1"











share|improve this question


























  • You are building html into 'RecruitmentTracking.txt', you should change it to index.html

    – nucleartux
    Mar 28 at 21:22











  • @nucleartux I have an index.html file within /dist and the .txt file is there because it's uploaded into a CMS.

    – Bodrov
    Apr 1 at 13:45











  • @freedomn-m Do you mean the relative paths within webpack.config.js?

    – Bodrov
    Apr 1 at 13:47

















3















I have an index.js file that imports my CSS and a few packages, but after bundling everything and starting the server I noticed that index.js wasn't running. I did a simple console.log in index.js and it isn't reached.



I copied the contents of my webpack.config file from a previous project which was working correctly, so I'm not sure if it's a file structure/path error or what not. Any thoughts?



Directory structure:



enter image description here



webpack.config.js:



const path = require('path')
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin')
var $ = require("jquery");

var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
template: './src/index.html',
filename: 'RecruitmentTracking.txt',
inject: 'body'
);

module.exports =
entry: "./src/index.js", // removing the . fails the build
output:
filename: './SiteAssets/scripts/RecruitmentTracking.js',
path: path.resolve(__dirname, 'dist')
,

module:
rules: [
loader: 'babel-loader',
test: /.js$/,
exclude: /node_modules/
,
test: /.css$/,
use: ['style-loader', 'css-loader']
,
test: /.(png
],
,
devServer:
disableHostCheck: true
,
devtool: 'cheap-module-eval-source-map', // this helps to browser to point to the exact file in the console, helps in debug
devServer:
contentBase: path.join(__dirname, 'src'),
historyApiFallback: true // this prevents the default browser full page refresh on form submission and link change
,
plugins: [
HtmlWebpackPluginConfig,
new webpack.ProvidePlugin(
"$": "jquery",
"jQuery": "jquery",
"window.jQuery": "jquery"
)]



index.js:



import "./RecruitmentTracking.css";
import 'jquery';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
import 'jquery-ui-bundle/jquery-ui.min.js';

console.log('this is index.js');


package.json:




"name": "recruitmenttracking",
"version": "1.0.0",
"description": "Recruitment Initiatives Tracking",
"main": "index.js", // ----- should a more specific file path be here?
"scripts":
"test": "echo "Error: no test specified" && exit 1",
"start": "webpack-dev-server --open --mode development",
"build": "webpack --config webpack.config.js",
"dev-server": "webpack-dev-server"
,
"author": "",
"license": "ISC",
"devDependencies":
"@babel/cli": "^7.2.3",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"style-loader": "^0.23.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
,
"dependencies":
"@babel/polyfill": "^7.4.0",
"axios": "^0.18.0",
"bootstrap": "^4.3.1",
"jquery": "^3.3.1",
"jquery-ui-bundle": "^1.12.1-migrate",
"pdfmake": "^0.1.54",
"popper": "^1.0.1"











share|improve this question


























  • You are building html into 'RecruitmentTracking.txt', you should change it to index.html

    – nucleartux
    Mar 28 at 21:22











  • @nucleartux I have an index.html file within /dist and the .txt file is there because it's uploaded into a CMS.

    – Bodrov
    Apr 1 at 13:45











  • @freedomn-m Do you mean the relative paths within webpack.config.js?

    – Bodrov
    Apr 1 at 13:47













3












3








3








I have an index.js file that imports my CSS and a few packages, but after bundling everything and starting the server I noticed that index.js wasn't running. I did a simple console.log in index.js and it isn't reached.



I copied the contents of my webpack.config file from a previous project which was working correctly, so I'm not sure if it's a file structure/path error or what not. Any thoughts?



Directory structure:



enter image description here



webpack.config.js:



const path = require('path')
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin')
var $ = require("jquery");

var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
template: './src/index.html',
filename: 'RecruitmentTracking.txt',
inject: 'body'
);

module.exports =
entry: "./src/index.js", // removing the . fails the build
output:
filename: './SiteAssets/scripts/RecruitmentTracking.js',
path: path.resolve(__dirname, 'dist')
,

module:
rules: [
loader: 'babel-loader',
test: /.js$/,
exclude: /node_modules/
,
test: /.css$/,
use: ['style-loader', 'css-loader']
,
test: /.(png
],
,
devServer:
disableHostCheck: true
,
devtool: 'cheap-module-eval-source-map', // this helps to browser to point to the exact file in the console, helps in debug
devServer:
contentBase: path.join(__dirname, 'src'),
historyApiFallback: true // this prevents the default browser full page refresh on form submission and link change
,
plugins: [
HtmlWebpackPluginConfig,
new webpack.ProvidePlugin(
"$": "jquery",
"jQuery": "jquery",
"window.jQuery": "jquery"
)]



index.js:



import "./RecruitmentTracking.css";
import 'jquery';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
import 'jquery-ui-bundle/jquery-ui.min.js';

console.log('this is index.js');


package.json:




"name": "recruitmenttracking",
"version": "1.0.0",
"description": "Recruitment Initiatives Tracking",
"main": "index.js", // ----- should a more specific file path be here?
"scripts":
"test": "echo "Error: no test specified" && exit 1",
"start": "webpack-dev-server --open --mode development",
"build": "webpack --config webpack.config.js",
"dev-server": "webpack-dev-server"
,
"author": "",
"license": "ISC",
"devDependencies":
"@babel/cli": "^7.2.3",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"style-loader": "^0.23.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
,
"dependencies":
"@babel/polyfill": "^7.4.0",
"axios": "^0.18.0",
"bootstrap": "^4.3.1",
"jquery": "^3.3.1",
"jquery-ui-bundle": "^1.12.1-migrate",
"pdfmake": "^0.1.54",
"popper": "^1.0.1"











share|improve this question
















I have an index.js file that imports my CSS and a few packages, but after bundling everything and starting the server I noticed that index.js wasn't running. I did a simple console.log in index.js and it isn't reached.



I copied the contents of my webpack.config file from a previous project which was working correctly, so I'm not sure if it's a file structure/path error or what not. Any thoughts?



Directory structure:



enter image description here



webpack.config.js:



const path = require('path')
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin')
var $ = require("jquery");

var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
template: './src/index.html',
filename: 'RecruitmentTracking.txt',
inject: 'body'
);

module.exports =
entry: "./src/index.js", // removing the . fails the build
output:
filename: './SiteAssets/scripts/RecruitmentTracking.js',
path: path.resolve(__dirname, 'dist')
,

module:
rules: [
loader: 'babel-loader',
test: /.js$/,
exclude: /node_modules/
,
test: /.css$/,
use: ['style-loader', 'css-loader']
,
test: /.(png
],
,
devServer:
disableHostCheck: true
,
devtool: 'cheap-module-eval-source-map', // this helps to browser to point to the exact file in the console, helps in debug
devServer:
contentBase: path.join(__dirname, 'src'),
historyApiFallback: true // this prevents the default browser full page refresh on form submission and link change
,
plugins: [
HtmlWebpackPluginConfig,
new webpack.ProvidePlugin(
"$": "jquery",
"jQuery": "jquery",
"window.jQuery": "jquery"
)]



index.js:



import "./RecruitmentTracking.css";
import 'jquery';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
import 'jquery-ui-bundle/jquery-ui.min.js';

console.log('this is index.js');


package.json:




"name": "recruitmenttracking",
"version": "1.0.0",
"description": "Recruitment Initiatives Tracking",
"main": "index.js", // ----- should a more specific file path be here?
"scripts":
"test": "echo "Error: no test specified" && exit 1",
"start": "webpack-dev-server --open --mode development",
"build": "webpack --config webpack.config.js",
"dev-server": "webpack-dev-server"
,
"author": "",
"license": "ISC",
"devDependencies":
"@babel/cli": "^7.2.3",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"style-loader": "^0.23.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
,
"dependencies":
"@babel/polyfill": "^7.4.0",
"axios": "^0.18.0",
"bootstrap": "^4.3.1",
"jquery": "^3.3.1",
"jquery-ui-bundle": "^1.12.1-migrate",
"pdfmake": "^0.1.54",
"popper": "^1.0.1"








javascript jquery webpack bundle






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 21:25







Bodrov

















asked Mar 28 at 21:16









BodrovBodrov

29915 bronze badges




29915 bronze badges















  • You are building html into 'RecruitmentTracking.txt', you should change it to index.html

    – nucleartux
    Mar 28 at 21:22











  • @nucleartux I have an index.html file within /dist and the .txt file is there because it's uploaded into a CMS.

    – Bodrov
    Apr 1 at 13:45











  • @freedomn-m Do you mean the relative paths within webpack.config.js?

    – Bodrov
    Apr 1 at 13:47

















  • You are building html into 'RecruitmentTracking.txt', you should change it to index.html

    – nucleartux
    Mar 28 at 21:22











  • @nucleartux I have an index.html file within /dist and the .txt file is there because it's uploaded into a CMS.

    – Bodrov
    Apr 1 at 13:45











  • @freedomn-m Do you mean the relative paths within webpack.config.js?

    – Bodrov
    Apr 1 at 13:47
















You are building html into 'RecruitmentTracking.txt', you should change it to index.html

– nucleartux
Mar 28 at 21:22





You are building html into 'RecruitmentTracking.txt', you should change it to index.html

– nucleartux
Mar 28 at 21:22













@nucleartux I have an index.html file within /dist and the .txt file is there because it's uploaded into a CMS.

– Bodrov
Apr 1 at 13:45





@nucleartux I have an index.html file within /dist and the .txt file is there because it's uploaded into a CMS.

– Bodrov
Apr 1 at 13:45













@freedomn-m Do you mean the relative paths within webpack.config.js?

– Bodrov
Apr 1 at 13:47





@freedomn-m Do you mean the relative paths within webpack.config.js?

– Bodrov
Apr 1 at 13:47












3 Answers
3






active

oldest

votes


















3







+50









What's happening here is:



1 - webpack compiles and outputs into: './SiteAssets/scripts/RecruitmentTracking.js'



2 - HtmlWebpackPlugin, will then read the template file './src/index.html', and inject RecruitmentTracking.js script inside the body.



3 - then, it outputs the result to dist/RecruitmentTracking.txt



I don't see any problem, apart from the file being a .txt and not .html. and would obviously not be interpreted by the browser.



Try outputting to an html file instead, it should work






share|improve this answer


































    1
















    1) For some reason you've configured the following plugin to output a .txt file. So don't expect the browser to intepret that as a html file



    var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
    template: './src/index.html',
    filename: 'RecruitmentTracking.txt',
    inject: 'body'
    );


    2) Also I believe that file that you're opening in the browser is /dist/index.html and that file doesn't load your js file. Try adding the following line into /dist/index.html:



    <script src"./SiteAssets/scripts/RecruitmentTracking.js"></script>


    3) If the above works, please still consider taking a closer look at (1)






    share|improve this answer
































      1
















      You have named the output file in HtmlWebpackPluginConfig as RecruitmentTracking.txt. change it to index.html and it should work



      var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
      template: './src/index.html', // webpack takes ./src/index.html as input file
      filename: 'index.html', // webpack processes the above input template and should output to index.html
      inject: 'body'
      );





      share|improve this answer


























        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',
        autoActivateHeartbeat: false,
        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/4.0/"u003ecc by-sa 4.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%2f55406965%2fwebpack-bundles-files-but-index-js-isnt-running%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        3







        +50









        What's happening here is:



        1 - webpack compiles and outputs into: './SiteAssets/scripts/RecruitmentTracking.js'



        2 - HtmlWebpackPlugin, will then read the template file './src/index.html', and inject RecruitmentTracking.js script inside the body.



        3 - then, it outputs the result to dist/RecruitmentTracking.txt



        I don't see any problem, apart from the file being a .txt and not .html. and would obviously not be interpreted by the browser.



        Try outputting to an html file instead, it should work






        share|improve this answer































          3







          +50









          What's happening here is:



          1 - webpack compiles and outputs into: './SiteAssets/scripts/RecruitmentTracking.js'



          2 - HtmlWebpackPlugin, will then read the template file './src/index.html', and inject RecruitmentTracking.js script inside the body.



          3 - then, it outputs the result to dist/RecruitmentTracking.txt



          I don't see any problem, apart from the file being a .txt and not .html. and would obviously not be interpreted by the browser.



          Try outputting to an html file instead, it should work






          share|improve this answer





























            3







            +50







            3







            +50



            3






            +50





            What's happening here is:



            1 - webpack compiles and outputs into: './SiteAssets/scripts/RecruitmentTracking.js'



            2 - HtmlWebpackPlugin, will then read the template file './src/index.html', and inject RecruitmentTracking.js script inside the body.



            3 - then, it outputs the result to dist/RecruitmentTracking.txt



            I don't see any problem, apart from the file being a .txt and not .html. and would obviously not be interpreted by the browser.



            Try outputting to an html file instead, it should work






            share|improve this answer















            What's happening here is:



            1 - webpack compiles and outputs into: './SiteAssets/scripts/RecruitmentTracking.js'



            2 - HtmlWebpackPlugin, will then read the template file './src/index.html', and inject RecruitmentTracking.js script inside the body.



            3 - then, it outputs the result to dist/RecruitmentTracking.txt



            I don't see any problem, apart from the file being a .txt and not .html. and would obviously not be interpreted by the browser.



            Try outputting to an html file instead, it should work







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 12 at 13:28

























            answered Apr 3 at 12:24









            HalimHalim

            4713 silver badges10 bronze badges




            4713 silver badges10 bronze badges


























                1
















                1) For some reason you've configured the following plugin to output a .txt file. So don't expect the browser to intepret that as a html file



                var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
                template: './src/index.html',
                filename: 'RecruitmentTracking.txt',
                inject: 'body'
                );


                2) Also I believe that file that you're opening in the browser is /dist/index.html and that file doesn't load your js file. Try adding the following line into /dist/index.html:



                <script src"./SiteAssets/scripts/RecruitmentTracking.js"></script>


                3) If the above works, please still consider taking a closer look at (1)






                share|improve this answer





























                  1
















                  1) For some reason you've configured the following plugin to output a .txt file. So don't expect the browser to intepret that as a html file



                  var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
                  template: './src/index.html',
                  filename: 'RecruitmentTracking.txt',
                  inject: 'body'
                  );


                  2) Also I believe that file that you're opening in the browser is /dist/index.html and that file doesn't load your js file. Try adding the following line into /dist/index.html:



                  <script src"./SiteAssets/scripts/RecruitmentTracking.js"></script>


                  3) If the above works, please still consider taking a closer look at (1)






                  share|improve this answer



























                    1














                    1










                    1









                    1) For some reason you've configured the following plugin to output a .txt file. So don't expect the browser to intepret that as a html file



                    var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
                    template: './src/index.html',
                    filename: 'RecruitmentTracking.txt',
                    inject: 'body'
                    );


                    2) Also I believe that file that you're opening in the browser is /dist/index.html and that file doesn't load your js file. Try adding the following line into /dist/index.html:



                    <script src"./SiteAssets/scripts/RecruitmentTracking.js"></script>


                    3) If the above works, please still consider taking a closer look at (1)






                    share|improve this answer













                    1) For some reason you've configured the following plugin to output a .txt file. So don't expect the browser to intepret that as a html file



                    var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
                    template: './src/index.html',
                    filename: 'RecruitmentTracking.txt',
                    inject: 'body'
                    );


                    2) Also I believe that file that you're opening in the browser is /dist/index.html and that file doesn't load your js file. Try adding the following line into /dist/index.html:



                    <script src"./SiteAssets/scripts/RecruitmentTracking.js"></script>


                    3) If the above works, please still consider taking a closer look at (1)







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 8 at 4:50









                    jkrisjkris

                    2,75716 silver badges27 bronze badges




                    2,75716 silver badges27 bronze badges
























                        1
















                        You have named the output file in HtmlWebpackPluginConfig as RecruitmentTracking.txt. change it to index.html and it should work



                        var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
                        template: './src/index.html', // webpack takes ./src/index.html as input file
                        filename: 'index.html', // webpack processes the above input template and should output to index.html
                        inject: 'body'
                        );





                        share|improve this answer





























                          1
















                          You have named the output file in HtmlWebpackPluginConfig as RecruitmentTracking.txt. change it to index.html and it should work



                          var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
                          template: './src/index.html', // webpack takes ./src/index.html as input file
                          filename: 'index.html', // webpack processes the above input template and should output to index.html
                          inject: 'body'
                          );





                          share|improve this answer



























                            1














                            1










                            1









                            You have named the output file in HtmlWebpackPluginConfig as RecruitmentTracking.txt. change it to index.html and it should work



                            var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
                            template: './src/index.html', // webpack takes ./src/index.html as input file
                            filename: 'index.html', // webpack processes the above input template and should output to index.html
                            inject: 'body'
                            );





                            share|improve this answer













                            You have named the output file in HtmlWebpackPluginConfig as RecruitmentTracking.txt. change it to index.html and it should work



                            var HtmlWebpackPluginConfig = new HtmlWebpackPlugin(
                            template: './src/index.html', // webpack takes ./src/index.html as input file
                            filename: 'index.html', // webpack processes the above input template and should output to index.html
                            inject: 'body'
                            );






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Apr 8 at 10:56









                            Arpit AryaArpit Arya

                            1156 bronze badges




                            1156 bronze badges































                                draft saved

                                draft discarded















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406965%2fwebpack-bundles-files-but-index-js-isnt-running%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







                                Popular posts from this blog

                                Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                                Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript