代码拉取完成,页面将自动刷新
var path = require('path');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
module.exports = {
entry: {
lib: ['react', 'react-dom'],
gui: './app/index.jsx'
},
output: {
path: path.resolve(__dirname, 'nwjs/app'),
filename: '[name].js'
},
devServer: {
contentBase: path.resolve(__dirname, 'nwjs/app'),
host: '0.0.0.0'
},
target: 'node-webkit',
module: {
externals: {
React: 'react',
ReactDOM: 'react-dom'
},
loaders: [{
test: /\.jsx?$/,
loader: 'babel-loader',
include: path.resolve(__dirname, 'app'),
query: {
plugins: ['transform-object-rest-spread'],
presets: ['es2015', 'react']
}
},
{
test: /\.svg$/,
loader: 'svg-url-loader?noquotes'
},
{
test : /\.(ttf|eot|png|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
loader : 'file-loader'
},
{
test: /\.json$/,
loader: 'json-loader'
},{
test: /\.css$/, // Only .css files
loader: 'style!css' // Run both loaders
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env.BASE_PATH': '"' + (process.env.BASE_PATH || '/') + '"'
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'lib',
filename: 'lib.min.js'
}),
new HtmlWebpackPlugin({
title: 'KittenBlock',
template: 'index.html'
}),
new CopyWebpackPlugin([{
from: 'scratch-blocks/media',
to: 'media'
}])
].concat(process.env.NODE_ENV === 'production' ? [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
compress: {
warnings: false
}
})
] : [])
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。