When typing command “npm run dev” for webpack, it creates a folder that ends with NaN












0















i'm taking a course in Lynda.com "learning-full-stack-javascript-development-mongodb-node-and-react" and when i use the command "npm run dev" to create a bundle.js file in "public" folder, it creates a folder "publicNaN" and puts the file bundle.js in it.
i want it to be in the "public" folder.



here is the webpack.config.js file:






const path = require("path");

const BUILD_PATH = path.join(__dirname, "./public");

// See https://github.com/Microsoft/vscode/blob/master/extensions/shared.webpack.config.js
module.exports = {
mode: "production",
target: "node",
node: {
__dirname: false
},
entry: {
extension: ["./src/index.js"]
},
output: {
path: BUILD_PATH + + '/public',
filename: "bundle.js",
libraryTarget: "commonjs",
},
resolve: {
extensions: [".ts", ".js"]
},
externals: {
"vscode": "commonjs vscode"
},
module: {
rules: [
{
test: /.ts$/,
use: [
{
loader: "ts-loader"
}
],
exclude: /node_modules/
},
{
test: /.mjs$/,
type: "javascript/auto",
use:
}
]
},
stats: {
children: false,
modules: false
}
};












share|improve this question




















  • 2





    you mistyped BUILD_PATH + +, which incremented it as a number

    – William Chong
    Nov 21 '18 at 15:31











  • The second + tried to turn /public into a number, resulting in NaN (not a number). You'll want: path: BUILD_PATH, given that BUILD_PATH already ends in /public.

    – Chris G
    Nov 21 '18 at 15:32


















0















i'm taking a course in Lynda.com "learning-full-stack-javascript-development-mongodb-node-and-react" and when i use the command "npm run dev" to create a bundle.js file in "public" folder, it creates a folder "publicNaN" and puts the file bundle.js in it.
i want it to be in the "public" folder.



here is the webpack.config.js file:






const path = require("path");

const BUILD_PATH = path.join(__dirname, "./public");

// See https://github.com/Microsoft/vscode/blob/master/extensions/shared.webpack.config.js
module.exports = {
mode: "production",
target: "node",
node: {
__dirname: false
},
entry: {
extension: ["./src/index.js"]
},
output: {
path: BUILD_PATH + + '/public',
filename: "bundle.js",
libraryTarget: "commonjs",
},
resolve: {
extensions: [".ts", ".js"]
},
externals: {
"vscode": "commonjs vscode"
},
module: {
rules: [
{
test: /.ts$/,
use: [
{
loader: "ts-loader"
}
],
exclude: /node_modules/
},
{
test: /.mjs$/,
type: "javascript/auto",
use:
}
]
},
stats: {
children: false,
modules: false
}
};












share|improve this question




















  • 2





    you mistyped BUILD_PATH + +, which incremented it as a number

    – William Chong
    Nov 21 '18 at 15:31











  • The second + tried to turn /public into a number, resulting in NaN (not a number). You'll want: path: BUILD_PATH, given that BUILD_PATH already ends in /public.

    – Chris G
    Nov 21 '18 at 15:32
















0












0








0








i'm taking a course in Lynda.com "learning-full-stack-javascript-development-mongodb-node-and-react" and when i use the command "npm run dev" to create a bundle.js file in "public" folder, it creates a folder "publicNaN" and puts the file bundle.js in it.
i want it to be in the "public" folder.



here is the webpack.config.js file:






const path = require("path");

const BUILD_PATH = path.join(__dirname, "./public");

// See https://github.com/Microsoft/vscode/blob/master/extensions/shared.webpack.config.js
module.exports = {
mode: "production",
target: "node",
node: {
__dirname: false
},
entry: {
extension: ["./src/index.js"]
},
output: {
path: BUILD_PATH + + '/public',
filename: "bundle.js",
libraryTarget: "commonjs",
},
resolve: {
extensions: [".ts", ".js"]
},
externals: {
"vscode": "commonjs vscode"
},
module: {
rules: [
{
test: /.ts$/,
use: [
{
loader: "ts-loader"
}
],
exclude: /node_modules/
},
{
test: /.mjs$/,
type: "javascript/auto",
use:
}
]
},
stats: {
children: false,
modules: false
}
};












share|improve this question
















i'm taking a course in Lynda.com "learning-full-stack-javascript-development-mongodb-node-and-react" and when i use the command "npm run dev" to create a bundle.js file in "public" folder, it creates a folder "publicNaN" and puts the file bundle.js in it.
i want it to be in the "public" folder.



here is the webpack.config.js file:






const path = require("path");

const BUILD_PATH = path.join(__dirname, "./public");

// See https://github.com/Microsoft/vscode/blob/master/extensions/shared.webpack.config.js
module.exports = {
mode: "production",
target: "node",
node: {
__dirname: false
},
entry: {
extension: ["./src/index.js"]
},
output: {
path: BUILD_PATH + + '/public',
filename: "bundle.js",
libraryTarget: "commonjs",
},
resolve: {
extensions: [".ts", ".js"]
},
externals: {
"vscode": "commonjs vscode"
},
module: {
rules: [
{
test: /.ts$/,
use: [
{
loader: "ts-loader"
}
],
exclude: /node_modules/
},
{
test: /.mjs$/,
type: "javascript/auto",
use:
}
]
},
stats: {
children: false,
modules: false
}
};








const path = require("path");

const BUILD_PATH = path.join(__dirname, "./public");

// See https://github.com/Microsoft/vscode/blob/master/extensions/shared.webpack.config.js
module.exports = {
mode: "production",
target: "node",
node: {
__dirname: false
},
entry: {
extension: ["./src/index.js"]
},
output: {
path: BUILD_PATH + + '/public',
filename: "bundle.js",
libraryTarget: "commonjs",
},
resolve: {
extensions: [".ts", ".js"]
},
externals: {
"vscode": "commonjs vscode"
},
module: {
rules: [
{
test: /.ts$/,
use: [
{
loader: "ts-loader"
}
],
exclude: /node_modules/
},
{
test: /.mjs$/,
type: "javascript/auto",
use:
}
]
},
stats: {
children: false,
modules: false
}
};





const path = require("path");

const BUILD_PATH = path.join(__dirname, "./public");

// See https://github.com/Microsoft/vscode/blob/master/extensions/shared.webpack.config.js
module.exports = {
mode: "production",
target: "node",
node: {
__dirname: false
},
entry: {
extension: ["./src/index.js"]
},
output: {
path: BUILD_PATH + + '/public',
filename: "bundle.js",
libraryTarget: "commonjs",
},
resolve: {
extensions: [".ts", ".js"]
},
externals: {
"vscode": "commonjs vscode"
},
module: {
rules: [
{
test: /.ts$/,
use: [
{
loader: "ts-loader"
}
],
exclude: /node_modules/
},
{
test: /.mjs$/,
type: "javascript/auto",
use:
}
]
},
stats: {
children: false,
modules: false
}
};






javascript reactjs webpack






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 23:25









wanttobeprofessional

1,02931323




1,02931323










asked Nov 21 '18 at 15:29









noy levinoy levi

104




104








  • 2





    you mistyped BUILD_PATH + +, which incremented it as a number

    – William Chong
    Nov 21 '18 at 15:31











  • The second + tried to turn /public into a number, resulting in NaN (not a number). You'll want: path: BUILD_PATH, given that BUILD_PATH already ends in /public.

    – Chris G
    Nov 21 '18 at 15:32
















  • 2





    you mistyped BUILD_PATH + +, which incremented it as a number

    – William Chong
    Nov 21 '18 at 15:31











  • The second + tried to turn /public into a number, resulting in NaN (not a number). You'll want: path: BUILD_PATH, given that BUILD_PATH already ends in /public.

    – Chris G
    Nov 21 '18 at 15:32










2




2





you mistyped BUILD_PATH + +, which incremented it as a number

– William Chong
Nov 21 '18 at 15:31





you mistyped BUILD_PATH + +, which incremented it as a number

– William Chong
Nov 21 '18 at 15:31













The second + tried to turn /public into a number, resulting in NaN (not a number). You'll want: path: BUILD_PATH, given that BUILD_PATH already ends in /public.

– Chris G
Nov 21 '18 at 15:32







The second + tried to turn /public into a number, resulting in NaN (not a number). You'll want: path: BUILD_PATH, given that BUILD_PATH already ends in /public.

– Chris G
Nov 21 '18 at 15:32














1 Answer
1






active

oldest

votes


















0














You're already setting your BUILD_PATH to /public here:



const BUILD_PATH = path.join(__dirname, "./public");


So there's no need to add it in the output object. Also the two + signs tries to convert to a number. That's why you get NaN at the end.



So change the output object to this:



output: {
path: BUILD_PATH,
filename: "bundle.js",
libraryTarget: "commonjs",
},





share|improve this answer


























  • This answer is perfectly fine but like I already mentioned, the + + tries to turn '/public' into a number (not increment BUILD_PATH). 13 + '10' results in the string '1310', but 13 + + '10' evaluates to the number 23. Also, this is a typo question. Flag it as such, instead of answering.

    – Chris G
    Nov 21 '18 at 15:49













  • Your're perfectly correct there. I used the wrong words there. I meant convert it to a number not increment. Will edit the post. And where do I type it as a typo question? Haven't been here that long so sorry but don't know how that works. So I'm not supposed to give a clear answer?

    – weibenfalk
    Nov 21 '18 at 15:59













  • The question is off-topic for stackoverflow, so no, you're not supposed to answer it. stackoverflow is not so much about helping individuals fix their problems but about building a repository of useful questions and answers. This question was answered in the comments because the OP still needs help with it, but since it's just a typo, it will not benefit anybody else and soon be closed or even removed. As soon as you're able, check the close link beneath a question and study the options that are available. As soon as a question matches those, don't answer it, just flag it.

    – Chris G
    Nov 21 '18 at 16:18











  • Ok I understand now. Thank you for the info.

    – weibenfalk
    Nov 21 '18 at 17:03











  • thank you! it worked.

    – noy levi
    Nov 22 '18 at 23:30












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/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%2f53415369%2fwhen-typing-command-npm-run-dev-for-webpack-it-creates-a-folder-that-ends-wit%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You're already setting your BUILD_PATH to /public here:



const BUILD_PATH = path.join(__dirname, "./public");


So there's no need to add it in the output object. Also the two + signs tries to convert to a number. That's why you get NaN at the end.



So change the output object to this:



output: {
path: BUILD_PATH,
filename: "bundle.js",
libraryTarget: "commonjs",
},





share|improve this answer


























  • This answer is perfectly fine but like I already mentioned, the + + tries to turn '/public' into a number (not increment BUILD_PATH). 13 + '10' results in the string '1310', but 13 + + '10' evaluates to the number 23. Also, this is a typo question. Flag it as such, instead of answering.

    – Chris G
    Nov 21 '18 at 15:49













  • Your're perfectly correct there. I used the wrong words there. I meant convert it to a number not increment. Will edit the post. And where do I type it as a typo question? Haven't been here that long so sorry but don't know how that works. So I'm not supposed to give a clear answer?

    – weibenfalk
    Nov 21 '18 at 15:59













  • The question is off-topic for stackoverflow, so no, you're not supposed to answer it. stackoverflow is not so much about helping individuals fix their problems but about building a repository of useful questions and answers. This question was answered in the comments because the OP still needs help with it, but since it's just a typo, it will not benefit anybody else and soon be closed or even removed. As soon as you're able, check the close link beneath a question and study the options that are available. As soon as a question matches those, don't answer it, just flag it.

    – Chris G
    Nov 21 '18 at 16:18











  • Ok I understand now. Thank you for the info.

    – weibenfalk
    Nov 21 '18 at 17:03











  • thank you! it worked.

    – noy levi
    Nov 22 '18 at 23:30
















0














You're already setting your BUILD_PATH to /public here:



const BUILD_PATH = path.join(__dirname, "./public");


So there's no need to add it in the output object. Also the two + signs tries to convert to a number. That's why you get NaN at the end.



So change the output object to this:



output: {
path: BUILD_PATH,
filename: "bundle.js",
libraryTarget: "commonjs",
},





share|improve this answer


























  • This answer is perfectly fine but like I already mentioned, the + + tries to turn '/public' into a number (not increment BUILD_PATH). 13 + '10' results in the string '1310', but 13 + + '10' evaluates to the number 23. Also, this is a typo question. Flag it as such, instead of answering.

    – Chris G
    Nov 21 '18 at 15:49













  • Your're perfectly correct there. I used the wrong words there. I meant convert it to a number not increment. Will edit the post. And where do I type it as a typo question? Haven't been here that long so sorry but don't know how that works. So I'm not supposed to give a clear answer?

    – weibenfalk
    Nov 21 '18 at 15:59













  • The question is off-topic for stackoverflow, so no, you're not supposed to answer it. stackoverflow is not so much about helping individuals fix their problems but about building a repository of useful questions and answers. This question was answered in the comments because the OP still needs help with it, but since it's just a typo, it will not benefit anybody else and soon be closed or even removed. As soon as you're able, check the close link beneath a question and study the options that are available. As soon as a question matches those, don't answer it, just flag it.

    – Chris G
    Nov 21 '18 at 16:18











  • Ok I understand now. Thank you for the info.

    – weibenfalk
    Nov 21 '18 at 17:03











  • thank you! it worked.

    – noy levi
    Nov 22 '18 at 23:30














0












0








0







You're already setting your BUILD_PATH to /public here:



const BUILD_PATH = path.join(__dirname, "./public");


So there's no need to add it in the output object. Also the two + signs tries to convert to a number. That's why you get NaN at the end.



So change the output object to this:



output: {
path: BUILD_PATH,
filename: "bundle.js",
libraryTarget: "commonjs",
},





share|improve this answer















You're already setting your BUILD_PATH to /public here:



const BUILD_PATH = path.join(__dirname, "./public");


So there's no need to add it in the output object. Also the two + signs tries to convert to a number. That's why you get NaN at the end.



So change the output object to this:



output: {
path: BUILD_PATH,
filename: "bundle.js",
libraryTarget: "commonjs",
},






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 15:59

























answered Nov 21 '18 at 15:43









weibenfalkweibenfalk

55618




55618













  • This answer is perfectly fine but like I already mentioned, the + + tries to turn '/public' into a number (not increment BUILD_PATH). 13 + '10' results in the string '1310', but 13 + + '10' evaluates to the number 23. Also, this is a typo question. Flag it as such, instead of answering.

    – Chris G
    Nov 21 '18 at 15:49













  • Your're perfectly correct there. I used the wrong words there. I meant convert it to a number not increment. Will edit the post. And where do I type it as a typo question? Haven't been here that long so sorry but don't know how that works. So I'm not supposed to give a clear answer?

    – weibenfalk
    Nov 21 '18 at 15:59













  • The question is off-topic for stackoverflow, so no, you're not supposed to answer it. stackoverflow is not so much about helping individuals fix their problems but about building a repository of useful questions and answers. This question was answered in the comments because the OP still needs help with it, but since it's just a typo, it will not benefit anybody else and soon be closed or even removed. As soon as you're able, check the close link beneath a question and study the options that are available. As soon as a question matches those, don't answer it, just flag it.

    – Chris G
    Nov 21 '18 at 16:18











  • Ok I understand now. Thank you for the info.

    – weibenfalk
    Nov 21 '18 at 17:03











  • thank you! it worked.

    – noy levi
    Nov 22 '18 at 23:30



















  • This answer is perfectly fine but like I already mentioned, the + + tries to turn '/public' into a number (not increment BUILD_PATH). 13 + '10' results in the string '1310', but 13 + + '10' evaluates to the number 23. Also, this is a typo question. Flag it as such, instead of answering.

    – Chris G
    Nov 21 '18 at 15:49













  • Your're perfectly correct there. I used the wrong words there. I meant convert it to a number not increment. Will edit the post. And where do I type it as a typo question? Haven't been here that long so sorry but don't know how that works. So I'm not supposed to give a clear answer?

    – weibenfalk
    Nov 21 '18 at 15:59













  • The question is off-topic for stackoverflow, so no, you're not supposed to answer it. stackoverflow is not so much about helping individuals fix their problems but about building a repository of useful questions and answers. This question was answered in the comments because the OP still needs help with it, but since it's just a typo, it will not benefit anybody else and soon be closed or even removed. As soon as you're able, check the close link beneath a question and study the options that are available. As soon as a question matches those, don't answer it, just flag it.

    – Chris G
    Nov 21 '18 at 16:18











  • Ok I understand now. Thank you for the info.

    – weibenfalk
    Nov 21 '18 at 17:03











  • thank you! it worked.

    – noy levi
    Nov 22 '18 at 23:30

















This answer is perfectly fine but like I already mentioned, the + + tries to turn '/public' into a number (not increment BUILD_PATH). 13 + '10' results in the string '1310', but 13 + + '10' evaluates to the number 23. Also, this is a typo question. Flag it as such, instead of answering.

– Chris G
Nov 21 '18 at 15:49







This answer is perfectly fine but like I already mentioned, the + + tries to turn '/public' into a number (not increment BUILD_PATH). 13 + '10' results in the string '1310', but 13 + + '10' evaluates to the number 23. Also, this is a typo question. Flag it as such, instead of answering.

– Chris G
Nov 21 '18 at 15:49















Your're perfectly correct there. I used the wrong words there. I meant convert it to a number not increment. Will edit the post. And where do I type it as a typo question? Haven't been here that long so sorry but don't know how that works. So I'm not supposed to give a clear answer?

– weibenfalk
Nov 21 '18 at 15:59







Your're perfectly correct there. I used the wrong words there. I meant convert it to a number not increment. Will edit the post. And where do I type it as a typo question? Haven't been here that long so sorry but don't know how that works. So I'm not supposed to give a clear answer?

– weibenfalk
Nov 21 '18 at 15:59















The question is off-topic for stackoverflow, so no, you're not supposed to answer it. stackoverflow is not so much about helping individuals fix their problems but about building a repository of useful questions and answers. This question was answered in the comments because the OP still needs help with it, but since it's just a typo, it will not benefit anybody else and soon be closed or even removed. As soon as you're able, check the close link beneath a question and study the options that are available. As soon as a question matches those, don't answer it, just flag it.

– Chris G
Nov 21 '18 at 16:18





The question is off-topic for stackoverflow, so no, you're not supposed to answer it. stackoverflow is not so much about helping individuals fix their problems but about building a repository of useful questions and answers. This question was answered in the comments because the OP still needs help with it, but since it's just a typo, it will not benefit anybody else and soon be closed or even removed. As soon as you're able, check the close link beneath a question and study the options that are available. As soon as a question matches those, don't answer it, just flag it.

– Chris G
Nov 21 '18 at 16:18













Ok I understand now. Thank you for the info.

– weibenfalk
Nov 21 '18 at 17:03





Ok I understand now. Thank you for the info.

– weibenfalk
Nov 21 '18 at 17:03













thank you! it worked.

– noy levi
Nov 22 '18 at 23:30





thank you! it worked.

– noy levi
Nov 22 '18 at 23:30




















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%2f53415369%2fwhen-typing-command-npm-run-dev-for-webpack-it-creates-a-folder-that-ends-wit%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

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)