Created
May 22, 2019 17:03
-
-
Save veeableful/d952f90a85d2b7c3fea1e9235ff036bd to your computer and use it in GitHub Desktop.
react app troubleshooting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var debug = process.envNODE_ENV !== "production"; | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
var WebpackUglifyJsPlugin = require('webpack-uglify-js-plugin'); | |
//var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var path = require('path'); | |
//var srcPath = path.join(__dirname, 'src'); | |
//var buildPath = path.join(__dirname, 'dist'); | |
var srcPath = path.join(__dirname, 'source'); | |
var buildPath = path.join(__dirname, 'public'); | |
var appPath = path.join(__dirname, 'app'); | |
module.exports = { | |
//devtool: 'cheap-module-source-map', | |
context: srcPath, | |
entry: { | |
applicationHome: path.join(srcPath, 'js', 'application.js'), | |
//index: path.join(srcPath, 'js', 'index.js'), | |
//login: path.join(srcPath, 'js', 'login.js'), | |
loginForgot: path.join(srcPath, 'js', 'login-forgot.js'), | |
loginReset: path.join(srcPath, 'js', 'login-reset.js'), | |
//profile: path.join(srcPath, 'js', 'profile.js'), | |
//profileEdit: path.join(srcPath, 'js', 'profile-edit.js'), | |
//alerts: path.join(srcPath, 'js', 'alerts.js'), | |
//accountManagement: path.join(srcPath, 'js', 'account-management.js'), | |
//addClientAccount: path.join(srcPath, 'js', 'add-client-account.js'), | |
//addPartnerAccount: path.join(srcPath, 'js', 'add-partner-account.js'), | |
//addRoleToClient: path.join(srcPath, 'js', 'add-role-to-client.js'), | |
//addRoleToPartner: path.join(srcPath, 'js', 'add-role-to-partner.js'), | |
//addUser: path.join(srcPath, 'js', 'add-user.js'), | |
//adminManagement: path.join(srcPath, 'js', 'admin-management.js'), | |
//manualFinding: path.join(srcPath, 'js', 'manual-finding.js'), | |
//feedEditor: path.join(srcPath, 'js', 'feed-editor.js'), | |
//feedEditorUpdate: path.join(srcPath, 'js', 'feed-editor-update.js'), | |
//search: path.join(srcPath, 'js', 'search.js'), | |
//editAccount: path.join(srcPath, 'js', 'edit-account.js'), | |
//editUser: path.join(srcPath, 'js', 'edit-user.js'), | |
//feedCreate: path.join(srcPath, 'js', 'feed-create.js'), | |
//feedManagement: path.join(srcPath, 'js', 'feed-management.js'), | |
//ruleAdd: path.join(srcPath, 'js', 'rule-add.js'), | |
//ruleEdit: path.join(srcPath, 'js', 'rule-edit.js'), | |
//rule: path.join(srcPath, 'js', 'rule.js'), | |
//userManagementAdmin: path.join(srcPath, 'js', 'user-management-admin.js'), | |
//userManagementAnalyst: path.join(srcPath, 'js', 'user-management-analyst.js'), | |
//userManagementManager: path.join(srcPath, 'js', 'user-management-manager.js'), | |
//userManagementUser: path.join(srcPath, 'js', 'user-management-user.js'), | |
timeline: path.join(srcPath, 'js', 'timeline.js'), | |
//reports: path.join(srcPath, 'js', 'reports.js'), | |
//reportsPartner: path.join(srcPath, 'js', 'reports-partner.js'), | |
//tools: path.join(srcPath, 'js', 'tools.js'), | |
vendor: ["jquery", "react", "axios", "moment"] | |
}, | |
output: { | |
path: buildPath, | |
filename: "./js/bundle--[name].js" | |
}, | |
watch: true, | |
module: { | |
//preLoaders: [ | |
// { | |
// test: /\.jsx?$/, | |
// exclude: /(node_modules|bower_components)/, | |
// loader: 'jshint-loader' | |
// } | |
//], | |
rules: [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /(node_modules|bower_components)/, | |
loader: 'babel-loader', | |
query: { | |
//presets: ['react', 'es2015', 'stage-2'] | |
presets: ['@babel/env', '@babel/react'], | |
plugins: ['@babel/plugin-proposal-class-properties'], | |
} | |
}, | |
{ | |
test: /\.css$/, | |
use: ['css-loader'], | |
//loader: ExtractTextPlugin.extract('style-loader', 'css-loader') | |
}, | |
{ | |
test: /\.scss$/, | |
use: ['css-loader', 'sass-loader'], | |
//loader: ExtractTextPlugin.extract('style-loader', 'sass-loader') | |
}, | |
{ | |
test: /\.(eot|svg|ttf|woff|woff2)$/, | |
loader: 'file-loader?publicPath=../&name=./fonts/[name].[ext]' | |
} | |
//{ | |
// test: /\.(eot|svg|ttf|woff|woff2)$/, | |
// loader: 'file-loader', | |
// options: { | |
// publicPath= "../", | |
// name: './fonts/[hash].[ext]', | |
// }, | |
//} | |
] | |
}, | |
devServer: { | |
historyApiFallback: true, | |
contentBase: './' | |
}, | |
plugins: [ | |
//new webpack.DefinePlugin({ | |
// 'process.env': { | |
// 'NODE_ENV': JSON.stringify('production') | |
// } | |
//}), | |
//new webpacl.optimize.UglifyJsPlugin({ | |
// compress: { warnings: false }, | |
// output: {comments: false}, | |
// mangle: false, | |
// sourcemap: false, | |
// minimize: true, | |
// mangle:{ except: ['$super', '$', 'exports', 'require', '$q', '$ocLazyLoad']} | |
//}), | |
new ExtractTextPlugin("./css/[name].css")/*, | |
new WebpackUglifyJsPlugin({ | |
cacheFolder: path.resolve(__dirname, 'public/cached_uglify/'), | |
debug: true, | |
minimize: true, | |
sourceMap: false, | |
output: { | |
comments: false | |
}, | |
compressor: { | |
warnings: false | |
} | |
})*/ | |
//new webpack.optimize.CommonsChunkPlugin({ | |
// minChunks: 2, | |
// name: "common" | |
//}) | |
], | |
optimization: { | |
namedModules: true, // old NamedModulesPlugin() | |
splitChunks: { // old CommonsChunkPlugin | |
chunks: "all" | |
}, | |
runtimeChunk: true, | |
concatenateModules: true // old ModuleConcatenationPlugin | |
}, | |
mode: 'development' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment