Revert webpack.config.js to original orbitdb one

This commit is contained in:
haad 2023-02-16 13:16:48 +02:00
parent 9212aaa224
commit 96a6d4fba8

View File

@ -1,26 +1,55 @@
import path from 'path'
import webpack from 'webpack'
import { fileURLToPath } from 'url'
import { createRequire } from 'module'
export default (env, argv) => {
const require = createRequire(import.meta.url)
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
return {
entry: './src/log.js',
mode: 'production',
entry: './src/OrbitDB.js',
output: {
libraryTarget: 'var',
library: 'Log',
filename: 'ipfslog.min.js'
filename: '../dist/orbitdb.min.js',
library: {
name: 'OrbitDB',
type: 'var',
export: 'default'
}
},
target: 'web',
mode: 'production',
externals: {
fs: '{ existsSync: () => true }',
mkdirp: '{}'
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
})
],
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
]
],
fallback: {
path: require.resolve('path-browserify'),
os: false,
fs: false,
constants: false,
stream: false
}
},
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
],
extensions: ['.js', '.json'],
mainFields: ['loader', 'main']
}
}
}
}