Commit be33f12f authored by gxkai's avatar gxkai

chore: 公用webpack

parent 75e0ec49
const nxWebpack = require('@nrwl/react/plugins/webpack')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = config => {
const nxWebpackConfig = nxWebpack(config)
const webpackConfig = {
...nxWebpackConfig,
node: {
fs: 'empty',
tls: 'empty',
readline: 'empty',
net: 'empty',
module: 'empty',
child_process: 'empty'
}
}
if (process.env.NODE_ENV === 'production') {
// const CompressionPlugin = require('compression-webpack-plugin')
// const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol']
// webpackConfig.plugins.push(new CompressionPlugin({
// filename: '[path].gz[query]',
// algorithm: 'gzip',
// test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
// threshold: 10240, // 只有大小大于该值的资源会被处理 10240
// minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
// deleteOriginalAssets: true // 删除原文件true=删
// }))
return {
...webpackConfig
// mode: 'production',
// devtool: 'nosources-cheap-module-source-map',
// optimization: {
// minimize: true,
// minimizer: [new TerserPlugin()]
// }
}
} else {
return webpackConfig
}
}
......@@ -27,68 +27,8 @@
<link rel="stylesheet" href="assets/css/pygment_trac.css">
<link rel="stylesheet" href="assets/fontawesome/css/all.min.css">
<link rel="icon" type="x-icon" href="assets/img/icon.png">
<!-- <script src="assets/js/browserfs.min.js"></script>-->
<!-- <script>-->
<!-- function urlParams () {-->
<!-- var qs = window.location.hash.substr(1)-->
<!-- if (window.location.search.length > 0) {-->
<!-- // use legacy query params instead of hash-->
<!-- window.location.hash = window.location.search.substr(1)-->
<!-- window.location.search = ''-->
<!-- }-->
<!-- var params = {}-->
<!-- var parts = qs.split('&')-->
<!-- for (var x in parts) {-->
<!-- var keyValue = parts[x].split('=')-->
<!-- if (keyValue[0] !== '') {-->
<!-- params[keyValue[0]] = keyValue[1]-->
<!-- }-->
<!-- }-->
<!-- return params-->
<!-- }-->
<!-- const defaultVersion = '0.8.0'-->
<!-- let versionToLoad = urlParams().appVersion ? urlParams().appVersion : defaultVersion-->
<!-- let assets = {-->
<!-- '0.8.0': ['assets/css/font-awesome-v5.8.1.min.css', 'assets/css/pygment_trac.css'],-->
<!-- '0.7.7': ['assets/css/font-awesome.min.css', 'assets/css/pygment_trac.css']-->
<!-- }-->
<!-- let versions = {-->
<!-- '0.7.7': 'assets/js/0.7.7/app.js', // commit 7b5c7ae3de935e0ccc32eadfd83bf7349478491e-->
<!-- '0.8.0': 'main.js'-->
<!-- }-->
<!-- for (let k in assets[versionToLoad]) {-->
<!-- let app = document.createElement('link')-->
<!-- app.setAttribute('rel', 'stylesheet')-->
<!-- app.setAttribute('href', assets[versionToLoad][k])-->
<!-- if (assets[versionToLoad][k] === 'https://use.fontawesome.com/releases/v5.8.1/css/all.css') {-->
<!-- app.setAttribute('integrity', 'sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf')-->
<!-- app.setAttribute('crossorigin', 'anonymous')-->
<!-- }-->
<!-- document.head.appendChild(app)-->
<!-- }-->
<!-- window.onload = () => {-->
<!-- BrowserFS.install(window)-->
<!-- BrowserFS.configure({-->
<!-- fs: "sessionStorage"-->
<!-- }, function(e) {-->
<!-- if (e) console.log(e)-->
<!-- let app = document.createElement('script')-->
<!-- app.setAttribute('src', versions[versionToLoad])-->
<!-- document.body.appendChild(app)-->
<!-- window.remixFileSystem = require('fs')-->
<!-- })-->
<!-- }-->
<!-- </script>-->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
<!-- <script src="runtime.js" type="module"></script>-->
<!-- <script src="runtime.es5.js" type="module"></script>-->
<!-- <script src="polyfills.js" type="module"></script>-->
<!-- <script src="vendor.js" type="module"></script>-->
<!-- <script src="vendor.es5.js" type="module"></script>-->
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--
The MIT License (MIT)
Copyright (c) 2014, 2015, the individual contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Remix - Ethereum IDE</title>
<link rel="stylesheet" href="assets/css/pygment_trac.css">
<link rel="icon" type="x-icon" href="icon.png">
<script src="assets/js/browserfs.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
<script>
function urlParams () {
var qs = window.location.hash.substr(1)
if (window.location.search.length > 0) {
// use legacy query params instead of hash
window.location.hash = window.location.search.substr(1)
window.location.search = ''
}
var params = {}
var parts = qs.split('&')
for (var x in parts) {
var keyValue = parts[x].split('=')
if (keyValue[0] !== '') {
params[keyValue[0]] = keyValue[1]
}
}
return params
}
const defaultVersion = '0.8.0'
let versionToLoad = urlParams().appVersion ? urlParams().appVersion : defaultVersion
let assets = {
'0.8.0': ['assets/css/font-awesome-v5.8.1.min.css', 'assets/css/pygment_trac.css'],
'0.7.7': ['assets/css/font-awesome.min.css', 'assets/css/pygment_trac.css']
}
let versions = {
'0.7.7': 'assets/js/0.7.7/app.js', // commit 7b5c7ae3de935e0ccc32eadfd83bf7349478491e
'0.8.0': 'main.js'
}
for (let k in assets[versionToLoad]) {
let app = document.createElement('link')
app.setAttribute('rel', 'stylesheet')
app.setAttribute('href', assets[versionToLoad][k])
if (assets[versionToLoad][k] === 'https://use.fontawesome.com/releases/v5.8.1/css/all.css') {
app.setAttribute('integrity', 'sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf')
app.setAttribute('crossorigin', 'anonymous')
}
document.head.appendChild(app)
}
window.onload = () => {
BrowserFS.install(window)
BrowserFS.configure({
fs: "sessionStorage"
}, function(e) {
if (e) console.log(e)
let app = document.createElement('script')
app.setAttribute('src', versions[versionToLoad])
document.body.appendChild(app)
window.remixFileSystem = require('fs')
})
}
</script>
</body>
</html>
......@@ -37,12 +37,12 @@ module.exports = config => {
// }),)
return {
...webpackConfig,
// mode: 'production',
// devtool: 'nosources-cheap-module-source-map',
// optimization: {
// minimize: true,
// minimizer: [new TerserPlugin()]
// }
mode: 'production',
devtool: 'nosources-cheap-module-source-map',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
}
} else {
return webpackConfig
......
const nxWebpack = require('@nrwl/react/plugins/webpack')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = config => {
const nxWebpackConfig = nxWebpack(config)
const webpackConfig = {
...nxWebpackConfig,
node: {
fs: 'empty',
tls: 'empty',
readline: 'empty',
net: 'empty',
module: 'empty',
child_process: 'empty'
}
}
if (process.env.NODE_ENV === 'production') {
// const CompressionPlugin = require('compression-webpack-plugin')
// const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol']
// webpackConfig.plugins.push(new CompressionPlugin({
// filename: '[path].gz[query]',
// algorithm: 'gzip',
// test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
// threshold: 10240, // 只有大小大于该值的资源会被处理 10240
// minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
// deleteOriginalAssets: true // 删除原文件true=删
// }))
return {
...webpackConfig
// mode: 'production',
// devtool: 'nosources-cheap-module-source-map',
// optimization: {
// minimize: true,
// minimizer: [new TerserPlugin()]
// }
}
} else {
return webpackConfig
}
}
......@@ -4,7 +4,7 @@ const minixhr = require('minixhr')
export const baseURLBin = 'https://binaries.soliditylang.org/bin'
// export const baseURLWasm = 'https://binaries.soliditylang.org/wasm'
export const baseURLWasm = `${window.location.origin}/assets/wasm`
export const baseURLWasm = `${window.location.origin}${window.location.pathname}assets/wasm`
export const pathToURL = {}
......
......@@ -57,10 +57,10 @@
"downloadsolc_assets": "wget --no-check-certificate https://binaries.soliditylang.org/wasm/soljson-v0.8.7+commit.e28d00a7.js -O ./apps/remix-ide/src/assets/js/soljson.js && wget --no-check-certificate https://binaries.soliditylang.org/wasm/soljson-v0.8.7+commit.e28d00a7.js -O ./apps/solidity-compiler/src/assets/js/soljson.js",
"make-mock-compiler": "node apps/remix-ide/ci/makeMockCompiler.js",
"minify": "uglifyjs --in-source-map inline --source-map-inline -c warnings=false",
"build:dev": "NODE_ENV=production nx build remix-ide --prod --skip-nx-cache",
"build:dev": "npm run fix-memory-limit & NODE_ENV=production nx build remix-ide --prod --skip-nx-cache",
"serve:dev": "npx http-server ./dist/apps/remix-ide",
"deploy:dev": "./deploy.sh 172.22.17.165",
"fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit",
"fix-memory-limit": "cross-env LIMIT=10000 increase-memory-limit",
"nightwatch_parallel": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=chrome,firefox",
"nightwatch_local_firefox": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=firefox",
"nightwatch_local_chrome": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=chrome",
......
......@@ -38,7 +38,7 @@
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"extractLicenses": false,
"vendorChunk": false,
"budgets": [
{
......@@ -644,7 +644,7 @@
],
"styles": [],
"scripts": [],
"webpackConfig": "apps/debugger/webpack.config.js",
"webpackConfig": "apps/remix-ide/webpack.config.js",
"maxWorkers": 2
},
"configurations": {
......@@ -895,7 +895,7 @@
],
"styles": ["apps/solidity-compiler/src/styles.css"],
"scripts": [],
"webpackConfig": "apps/solidity-compiler/webpack.config.js",
"webpackConfig": "apps/remix-ide/webpack.config.js",
"maxWorkers": 2
},
"configurations": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment