和webpack.config.js
devtool: false,
entry: ['babel-polyfill', './src/index.js'],
output: {
path: join(__dirname, 'lib'),
filename: '[name].js',
library: 'mylib',
libraryTarget: 'umd',
umdNamedDefine: true,
sourceMapFilename: `[name].js.map`,
},
...
new webpack.EnvironmentPlugin({
NODE_ENV: 'development',
POUCHDB_NAME: 'dbname'
}),
当我尝试在浏览器中打开 ( index.html
) ...
未捕获的 ReferenceError:进程未在 Object 中定义。(db.js:8) 在 Object.defineProperty.value (main.js:12716) 在 Object.crypto (main.js:12727) 在webpack_require (bootstrap 2becb557cb7088856bca:19) 在 Object.defineProperty.value (main.js: 18506)在对象。(main.js:18519) 在webpack_require (bootstrap 2becb557cb7088856bca:19) 在 Object.defineProperty.value (_replacer.js:8) 在 Object. (_replacer.js:8) 在webpack_require (bootstrap 2becb557cb7088856bca:19)
在db.js
我有..
const { POUCHDB_NAME = 'mydb' } = process.env;