admin管理员组文章数量:1025481
I am currently trying to run webpack with the mand set NODE_ENV=production && webpack
(Window User) But there was no output within the src directory with the name bundle.js, in fact there was no output file.
I have only used webpack-dev-server until now, so this is the first time I try to build a config file with plugins. webpack-dev-server as I have tried, is running okay.
src folder contains all my files including html and javascript.
I need an output files with working minified and pressed codes. Please assist and advise!!
The below was found in the terminal
Hash: 09ea2200290287327c75
Version: webpack 1.13.2
Time: 6976ms
Asset Size Chunks Chunk Names
bundle.js 3.48 MB 0 [emitted] main
[0] multi main 28 bytes {0} [built]
[1] ./src/index.js 2.73 kB {0} [built]
+ 12 hidden modules
I do have a webpack.config.js file that has the below config.
const path = require('path');
const webpack = require('webpack');
const debug = process.env.NODE_ENV !== "production";
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: path.resolve(__dirname,'/src'),
filename: 'bundle.js'
},
devtool: debug ? "inline-sourcemap" : null,
module: {
loader: [{
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['angular']
}
}]
},
devServer: {
historyApiFallback: true,
contentBase: 'src'
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
press: { warnings: false }
})
]
};
I am currently trying to run webpack with the mand set NODE_ENV=production && webpack
(Window User) But there was no output within the src directory with the name bundle.js, in fact there was no output file.
I have only used webpack-dev-server until now, so this is the first time I try to build a config file with plugins. webpack-dev-server as I have tried, is running okay.
src folder contains all my files including html and javascript.
I need an output files with working minified and pressed codes. Please assist and advise!!
The below was found in the terminal
Hash: 09ea2200290287327c75
Version: webpack 1.13.2
Time: 6976ms
Asset Size Chunks Chunk Names
bundle.js 3.48 MB 0 [emitted] main
[0] multi main 28 bytes {0} [built]
[1] ./src/index.js 2.73 kB {0} [built]
+ 12 hidden modules
I do have a webpack.config.js file that has the below config.
const path = require('path');
const webpack = require('webpack');
const debug = process.env.NODE_ENV !== "production";
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: path.resolve(__dirname,'/src'),
filename: 'bundle.js'
},
devtool: debug ? "inline-sourcemap" : null,
module: {
loader: [{
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['angular']
}
}]
},
devServer: {
historyApiFallback: true,
contentBase: 'src'
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
press: { warnings: false }
})
]
};
Share
Improve this question
asked Sep 21, 2016 at 11:38
Winson LiaoWinson Liao
1032 silver badges8 bronze badges
1 Answer
Reset to default 6This doesn't do what you are expecting:
path : path.resolve(__dirname, '/src')
Because it resolves to /src
, and not—as you probably expected—"src/
in the current directory".
For that, use this:
path : path.resolve(__dirname, 'src')
I am currently trying to run webpack with the mand set NODE_ENV=production && webpack
(Window User) But there was no output within the src directory with the name bundle.js, in fact there was no output file.
I have only used webpack-dev-server until now, so this is the first time I try to build a config file with plugins. webpack-dev-server as I have tried, is running okay.
src folder contains all my files including html and javascript.
I need an output files with working minified and pressed codes. Please assist and advise!!
The below was found in the terminal
Hash: 09ea2200290287327c75
Version: webpack 1.13.2
Time: 6976ms
Asset Size Chunks Chunk Names
bundle.js 3.48 MB 0 [emitted] main
[0] multi main 28 bytes {0} [built]
[1] ./src/index.js 2.73 kB {0} [built]
+ 12 hidden modules
I do have a webpack.config.js file that has the below config.
const path = require('path');
const webpack = require('webpack');
const debug = process.env.NODE_ENV !== "production";
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: path.resolve(__dirname,'/src'),
filename: 'bundle.js'
},
devtool: debug ? "inline-sourcemap" : null,
module: {
loader: [{
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['angular']
}
}]
},
devServer: {
historyApiFallback: true,
contentBase: 'src'
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
press: { warnings: false }
})
]
};
I am currently trying to run webpack with the mand set NODE_ENV=production && webpack
(Window User) But there was no output within the src directory with the name bundle.js, in fact there was no output file.
I have only used webpack-dev-server until now, so this is the first time I try to build a config file with plugins. webpack-dev-server as I have tried, is running okay.
src folder contains all my files including html and javascript.
I need an output files with working minified and pressed codes. Please assist and advise!!
The below was found in the terminal
Hash: 09ea2200290287327c75
Version: webpack 1.13.2
Time: 6976ms
Asset Size Chunks Chunk Names
bundle.js 3.48 MB 0 [emitted] main
[0] multi main 28 bytes {0} [built]
[1] ./src/index.js 2.73 kB {0} [built]
+ 12 hidden modules
I do have a webpack.config.js file that has the below config.
const path = require('path');
const webpack = require('webpack');
const debug = process.env.NODE_ENV !== "production";
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: path.resolve(__dirname,'/src'),
filename: 'bundle.js'
},
devtool: debug ? "inline-sourcemap" : null,
module: {
loader: [{
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['angular']
}
}]
},
devServer: {
historyApiFallback: true,
contentBase: 'src'
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
press: { warnings: false }
})
]
};
Share
Improve this question
asked Sep 21, 2016 at 11:38
Winson LiaoWinson Liao
1032 silver badges8 bronze badges
1 Answer
Reset to default 6This doesn't do what you are expecting:
path : path.resolve(__dirname, '/src')
Because it resolves to /src
, and not—as you probably expected—"src/
in the current directory".
For that, use this:
path : path.resolve(__dirname, 'src')
本文标签: javascriptwebpack not producing output filesStack Overflow
版权声明:本文标题:javascript - webpack not producing output files - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745635648a2160430.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论