mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-23 06:02:30 -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": {
|
"renderer": {
|
||||||
"webpackConfig": "webpack.renderer.additions.js"
|
"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"
|
"source-map-support": "^0.5.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.1.2",
|
||||||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
|
"@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",
|
"@babel/preset-react": "^7.0.0",
|
||||||
"async": "^2.6.1",
|
"async": "^2.6.1",
|
||||||
"babel-eslint": "^10.0.0",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-plugin-react-intl": "^3.0.1",
|
"babel-loader": "^8.0.4",
|
||||||
"copy-webpack-plugin": "^4.5.2",
|
"babel-plugin-react-intl": "^2.3.1",
|
||||||
|
"copy-webpack-plugin": "^4.5.1",
|
||||||
"electron": "^3.0.2",
|
"electron": "^3.0.2",
|
||||||
"electron-builder": "^20.28.1",
|
"electron-builder": "^20.28.1",
|
||||||
"electron-devtools-installer": "^2.2.4",
|
"electron-devtools-installer": "^2.2.4",
|
||||||
|
@ -35,7 +40,8 @@
|
||||||
"react-redux": "5.0.7",
|
"react-redux": "5.0.7",
|
||||||
"redux": "3.7.2",
|
"redux": "3.7.2",
|
||||||
"scratch-gui": "0.1.0-prerelease.20180927141400",
|
"scratch-gui": "0.1.0-prerelease.20180927141400",
|
||||||
"webpack": "^4.21.0"
|
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||||
|
"webpack": "^4.6.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"upath": "^1.0.5"
|
"upath": "^1.0.5"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
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';
|
import styles from 'scratch-gui/src/playground/index.css';
|
||||||
|
|
||||||
// Register "base" page view
|
// 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.
|
// in much lower dependencies.
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
plugins: [
|
plugins: [
|
||||||
'@babel/proposal-object-rest-spread',
|
'@babel/plugin-syntax-dynamic-import',
|
||||||
// 'syntax-dynamic-import',
|
'@babel/plugin-transform-async-to-generator',
|
||||||
// 'transform-async-to-generator',
|
'@babel/plugin-proposal-object-rest-spread',
|
||||||
['react-intl', {
|
['react-intl', {
|
||||||
messagesDir: './translations/messages/'
|
messagesDir: './translations/messages/'
|
||||||
}]
|
}]
|
||||||
],
|
],
|
||||||
presets: [
|
presets: [
|
||||||
['@babel/env', {targets: {electron: '3.0.2'}}],
|
['@babel/preset-env', {targets: {electron: '3.0.2'}}],
|
||||||
'@babel/react'
|
'@babel/preset-react'
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ module.exports = {
|
||||||
minimizer: [new UglifyJsPlugin({
|
minimizer: [new UglifyJsPlugin({
|
||||||
cache: true,
|
cache: true,
|
||||||
parallel: 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: {
|
splitChunks: {
|
||||||
chunks: 'all'
|
chunks: 'all'
|
||||||
|
|
Loading…
Reference in a new issue