Skip to content

Commit

Permalink
fix: pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
geolffreym committed Jan 7, 2022
1 parent e116906 commit b5a30fc
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 59 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"peerDependencies": {
"blockstore-core": "^1.0.2",
"blockstore-datastore-adapter": "^2.0.2",
"go-ipfs": "^0.10.0",
"ipfs": "0.60.2",
"level-js": "6.1.0",
"windows-elevate": "^1.0.1",
Expand Down
1 change: 0 additions & 1 deletion scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const { execPassthru, getElevateExec, osType } = require('./util')
log.info('Installing on', osType)
try {
// Try `npm cache clean --force` if packages isn't installed
await execPassthru('npm install go-ipfs@0.10.0 --no-save', await getElevateExec())
await execPassthru('npm install wrtc@0.4.7 ipfs@0.60.2 level-js@6.1.0 --no-save', await getElevateExec())
} catch (err) {
log.error(err)
Expand Down
120 changes: 64 additions & 56 deletions webpack/base.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,76 @@
import path, {join, resolve} from 'path'
import { aliasItems, devServerUrl, externalItems } from './config'
import {aliasItems, devServerUrl, externalItems} from './config'
import entry from './entry'
import { rootDir } from './utils/env'
import {rootDir} from './utils/env'
import optimization from './optimization'
import * as plugins from './plugins'
import * as rules from './rules'
import { isDevServer, isProd } from './utils/env'
import { arrayFilterEmpty } from './utils/helpers'
import {isDevServer, isProd} from './utils/env'
import {arrayFilterEmpty} from './utils/helpers'

const runtime = process.env.RUNTIME
const isWeb = runtime === 'web'
const buildPath = process.env.BUILD_PATH || 'src/build';


export default {
context: __dirname,
target: isWeb ? 'browserslist' : 'electron-renderer',
mode: isProd ? 'production' : 'development',
entry,
output: {
path: resolve(join(rootDir, buildPath)),
publicPath: isDevServer ? devServerUrl : './',
filename: isDevServer
? '[name].[fullhash].js'
: '[name].[contenthash].js'
},
module: {
strictExportPresence: true,
rules: arrayFilterEmpty([
rules.javascriptRule,
rules.typescriptRule,
rules.htmlRule,
rules.imagesRule,
rules.fontsRule,
rules.cssRule,
rules.sassRule,
...rules.svgRules
])
},
plugins: arrayFilterEmpty([
plugins.htmlWebpackPlugin,
plugins.providePlugin,
plugins.definePlugin,
plugins.nodePolyfillPlugin,
plugins.copyPlugin,
...(isProd && [plugins.workBoxSW] || [])
]),
resolve: {
modules: [
"node_modules",
path.resolve(__dirname)
],
alias: aliasItems,
extensions: ['.js', '.jsx', '.css', '.json', '.scss'],
fallback: {
stream: require.resolve("stream-browserify"),
fs: false
}
},
node: {
global: true,
__dirname: true,
__filename: true
},
optimization,
externals: externalItems,
devtool: 'inline-source-map',
context: __dirname,
target: isWeb ? 'browserslist' : 'electron-renderer',
mode: isProd ? 'production' : 'development',
entry,
output: {
path: resolve(join(rootDir, buildPath)),
publicPath: isDevServer ? devServerUrl : './',
filename: isDevServer
? '[name].[fullhash].js'
: '[name].[contenthash].js'
},
module: {
strictExportPresence: true,
rules: arrayFilterEmpty([
rules.javascriptRule,
rules.typescriptRule,
rules.htmlRule,
rules.imagesRule,
rules.fontsRule,
rules.cssRule,
rules.sassRule,
...rules.svgRules
])
},
plugins: arrayFilterEmpty([
plugins.htmlWebpackPlugin,
plugins.providePlugin,
plugins.definePlugin,
plugins.nodePolyfillPlugin,
plugins.copyPlugin,
...(isProd && [plugins.workBoxSW] || [])
]),
resolve: {
modules: [
"node_modules",
path.resolve(__dirname)
],
alias: aliasItems,
extensions: ['.js', '.jsx', '.css', '.json', '.scss'],
fallback: {
stream: require.resolve("stream-browserify"),
module: false,
dgram: false,
dns: 'mock',
fs: false,
http2: false,
net: false,
tls: false,
child_process: false,
}
},
node: {
global: true,
__dirname: true,
__filename: true
},
optimization,
externals: externalItems,
devtool: 'inline-source-map',
}
2 changes: 1 addition & 1 deletion webpack/config/devServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const buildPath = process.env.BUILD_PATH || 'src/build';


const defaultPort = 8082
const devServerHost = isWindows() ? '127.0.0.1' : '0.0.0.0'
const devServerHost = 'localhost'

export const devServerUrl = `http://${devServerHost}:${defaultPort}/`
const runElectron = process.env.RUNTIME === 'electron'
Expand Down

0 comments on commit b5a30fc

Please sign in to comment.