mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-22 21:52:31 -05:00
Fix build with/without npm ln
, match scratch-gui
Match the versions of Webpack, Babel, and related plugins as used in scratch-gui. That plus a few other tweaks means that this repository builds the same with or without `npm ln scratch-gui`, and also means that all syntax used in scratch-gui should build the same here.
This commit is contained in:
parent
42cba6414e
commit
53e8723086
6 changed files with 391 additions and 218 deletions
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"main": {
|
||||
"webpackConfig": "webpack.main.additions.js"
|
||||
},
|
||||
"renderer": {
|
||||
"webpackConfig": "webpack.renderer.additions.js"
|
||||
}
|
||||
|
|
532
package-lock.json
generated
532
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -14,12 +14,17 @@
|
|||
"source-map-support": "^0.5.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.2",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-transform-async-to-generator": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"async": "^2.6.1",
|
||||
"babel-eslint": "^10.0.0",
|
||||
"babel-plugin-react-intl": "^3.0.1",
|
||||
"copy-webpack-plugin": "^4.5.2",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-loader": "^8.0.4",
|
||||
"babel-plugin-react-intl": "^2.3.1",
|
||||
"copy-webpack-plugin": "^4.5.1",
|
||||
"electron": "^3.0.2",
|
||||
"electron-builder": "^20.28.1",
|
||||
"electron-devtools-installer": "^2.2.4",
|
||||
|
@ -35,7 +40,8 @@
|
|||
"react-redux": "5.0.7",
|
||||
"redux": "3.7.2",
|
||||
"scratch-gui": "0.1.0-prerelease.20180927141400",
|
||||
"webpack": "^4.21.0"
|
||||
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||
"webpack": "^4.6.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"upath": "^1.0.5"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import GUI, {AppStateHOC} from 'scratch-gui/dist/scratch-gui';
|
||||
import GUI, {AppStateHOC} from 'scratch-gui';
|
||||
import styles from 'scratch-gui/src/playground/index.css';
|
||||
|
||||
// Register "base" page view
|
||||
|
|
46
webpack.main.additions.js
Normal file
46
webpack.main.additions.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||
|
||||
const babelOptions = {
|
||||
// Explicitly disable babelrc so we don't catch various config
|
||||
// in much lower dependencies.
|
||||
babelrc: false,
|
||||
plugins: [
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-transform-async-to-generator',
|
||||
'@babel/plugin-proposal-object-rest-spread'
|
||||
],
|
||||
presets: [
|
||||
['@babel/preset-env', {targets: {electron: '3.0.2'}}]
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
devtool: 'cheap-module-source-map',
|
||||
module: {
|
||||
rules: [
|
||||
// Override the *.js defaults from electron-webpack
|
||||
// The test/include/exclude must match the defaults exactly for webpack-merge to do the override
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
loader: 'babel-loader',
|
||||
options: babelOptions
|
||||
}
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
// Use `--env.minify=false` to disable the UglifyJsPlugin instance automatically injected by electron-webpack.
|
||||
// Otherwise it will do double-duty with this one.
|
||||
minimizer: [new UglifyJsPlugin({
|
||||
cache: true,
|
||||
parallel: true,
|
||||
sourceMap: true // disable this if UglifyJSPlugin takes too long and/or runs out of memory
|
||||
})],
|
||||
splitChunks: {
|
||||
chunks: 'all'
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
symlinks: false
|
||||
}
|
||||
};
|
|
@ -8,16 +8,16 @@ const babelOptions = {
|
|||
// in much lower dependencies.
|
||||
babelrc: false,
|
||||
plugins: [
|
||||
'@babel/proposal-object-rest-spread',
|
||||
// 'syntax-dynamic-import',
|
||||
// 'transform-async-to-generator',
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-transform-async-to-generator',
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
['react-intl', {
|
||||
messagesDir: './translations/messages/'
|
||||
}]
|
||||
],
|
||||
presets: [
|
||||
['@babel/env', {targets: {electron: '3.0.2'}}],
|
||||
'@babel/react'
|
||||
['@babel/preset-env', {targets: {electron: '3.0.2'}}],
|
||||
'@babel/preset-react'
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ module.exports = {
|
|||
minimizer: [new UglifyJsPlugin({
|
||||
cache: true,
|
||||
parallel: true,
|
||||
sourceMap: false // takes too long and runs out of memory :(
|
||||
sourceMap: false // disable this if UglifyJSPlugin takes too long and/or runs out of memory
|
||||
})],
|
||||
splitChunks: {
|
||||
chunks: 'all'
|
||||
|
|
Loading…
Reference in a new issue