Skip to content

Commit

Permalink
Fix a variety of issues on Edge.
Browse files Browse the repository at this point in the history
  • Loading branch information
phulin committed Jan 11, 2020
1 parent d4b03ab commit 2dd7572
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function(api) {
presets: [
['@babel/preset-env', {
useBuiltIns: 'usage',
corejs: 2,
corejs: 3,
}],
'@babel/preset-react',
],
Expand Down
22 changes: 19 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"cheerio": "^1.0.0-rc.3",
"connect-flash": "^0.1.1",
"connect-mongodb-session": "^2.2.0",
"core-js": "^2.6.9",
"csurf": "^1.10.0",
"express": "^4.17.1",
"express-fileupload": "^1.1.5",
Expand Down Expand Up @@ -61,6 +60,7 @@
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"chart.js": "^2.9.2",
"core-js": "^3.6.3",
"eslint": "^6.1.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.5.0",
Expand Down
4 changes: 3 additions & 1 deletion routes/cube_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,10 @@ router.get('/list/:id', async function(req, res) {
}
}

console.log('user', req.user ? req.user.id === cube.owner : false);

const reactProps = {
canEdit: req.user && req.user.id === cube.owner,
canEdit: req.user ? req.user.id === cube.owner : false,
cubeID: req.params.id,
defaultTagColors: cube.tag_colors,
defaultShowTagColors: !req.user || !req.user.hide_tag_colors,
Expand Down
37 changes: 18 additions & 19 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ const merge = require('webpack-merge');
const nodeExternals = require('webpack-node-externals');

const config = {
context: path.resolve(__dirname, 'src'),
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
exclude: /node_modules[\/\\](?!react-dnd|dnd-core)/,
use: {
loader: 'babel-loader',
options: {
Expand All @@ -23,20 +22,20 @@ const config = {

const clientConfig = merge(config, {
entry: {
cube_analysis: './cube_analysis.js',
cube_blog: './cube_blog.js',
cube_compare: './cube_compare.js',
cube_deck: './cube_deck.js',
cube_deckbuilder: './cube_deckbuilder.js',
cube_draft: './cube_draft.js',
cube_list: './cube_list.js',
cube_overview: './cube_overview.js',
cube_playtest: './cube_playtest.js',
topcards: './topcards.js',
dashboard: './dashboard.js',
blogpost: './blogpost.js',
notifications: './notifications.js',
cardpage: './cardpage.js',
cube_analysis: './src/cube_analysis.js',
cube_blog: './src/cube_blog.js',
cube_compare: './src/cube_compare.js',
cube_deck: './src/cube_deck.js',
cube_deckbuilder: './src/cube_deckbuilder.js',
cube_draft: './src/cube_draft.js',
cube_list: './src/cube_list.js',
cube_overview: './src/cube_overview.js',
cube_playtest: './src/cube_playtest.js',
topcards: './src/topcards.js',
dashboard: './src/dashboard.js',
blogpost: './src/blogpost.js',
notifications: './src/notifications.js',
cardpage: './src/cardpage.js',
},
output: {
filename: '[name].bundle.js',
Expand All @@ -52,16 +51,16 @@ const clientConfig = merge(config, {
const serverConfig = merge(config, {
target: 'node',
entry: {
CubeListPage: './components/CubeListPage.js',
DashboardPage: './components/DashboardPage.js',
CubeListPage: './src/components/CubeListPage.js',
DashboardPage: './src/components/DashboardPage.js',
},
output: {
filename: '[name].js',
sourceMapFilename: '[name].js.map',
path: path.resolve(__dirname, 'dist', 'components'),
libraryTarget: 'commonjs2',
},
externals: [nodeExternals({ whitelist: ['react-tag-input', 'react-dnd', 'dnd-core', 'react-dnd-html5-backend'] })],
externals: [nodeExternals({ whitelist: ['react-tag-input', 'react-dnd', 'dnd-core', 'react-dnd-html5-backend', 'react-dnd-touch-backend'] })],
});

module.exports = { clientConfig, serverConfig };

0 comments on commit 2dd7572

Please sign in to comment.