Making `pack:web` work by adding polyfill (#2678)
* Making `pack:web` work * Removing unnecessary extra line * Ran `yarn install` to update the lock file * I'm pretty sure that my lockfile was dirty * Fixing an incorrect dependency resolution `buffer` doesn't have to be included through browserify
This commit is contained in:
		
							parent
							
								
									da5e967713
								
							
						
					
					
						commit
						2e84b442bc
					
				| 
						 | 
					@ -15,7 +15,7 @@ const isDevMode = process.env.NODE_ENV === 'development'
 | 
				
			||||||
const config = {
 | 
					const config = {
 | 
				
			||||||
  name: 'web',
 | 
					  name: 'web',
 | 
				
			||||||
  mode: process.env.NODE_ENV,
 | 
					  mode: process.env.NODE_ENV,
 | 
				
			||||||
  devtool: isDevMode ? '#cheap-module-eval-source-map' : false,
 | 
					  devtool: isDevMode ? 'eval-cheap-module-source-map' : false,
 | 
				
			||||||
  entry: {
 | 
					  entry: {
 | 
				
			||||||
    web: path.join(__dirname, '../src/renderer/main.js'),
 | 
					    web: path.join(__dirname, '../src/renderer/main.js'),
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					@ -23,6 +23,9 @@ const config = {
 | 
				
			||||||
    path: path.join(__dirname, '../dist/web'),
 | 
					    path: path.join(__dirname, '../dist/web'),
 | 
				
			||||||
    filename: '[name].js',
 | 
					    filename: '[name].js',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					  externals: {
 | 
				
			||||||
 | 
					    electron: '{}'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  module: {
 | 
					  module: {
 | 
				
			||||||
    rules: [
 | 
					    rules: [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
| 
						 | 
					@ -113,19 +116,18 @@ const config = {
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  node: {
 | 
					  node: {
 | 
				
			||||||
    __dirname: isDevMode,
 | 
					    __dirname: true,
 | 
				
			||||||
    __filename: isDevMode,
 | 
					    __filename: isDevMode,
 | 
				
			||||||
    fs: 'empty',
 | 
					 | 
				
			||||||
    net: 'empty',
 | 
					 | 
				
			||||||
    tls: 'empty',
 | 
					 | 
				
			||||||
    child_process: 'empty',
 | 
					 | 
				
			||||||
    dns: 'empty'
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  plugins: [
 | 
					  plugins: [
 | 
				
			||||||
    new webpack.DefinePlugin({
 | 
					    new webpack.DefinePlugin({
 | 
				
			||||||
      'process.env.PRODUCT_NAME': JSON.stringify(productName),
 | 
					      'process.env.PRODUCT_NAME': JSON.stringify(productName),
 | 
				
			||||||
      'process.env.IS_ELECTRON': false
 | 
					      'process.env.IS_ELECTRON': false
 | 
				
			||||||
    }),
 | 
					    }),
 | 
				
			||||||
 | 
					    new webpack.ProvidePlugin({
 | 
				
			||||||
 | 
					      process: 'process/browser',
 | 
				
			||||||
 | 
					      Buffer: ['buffer', 'Buffer'],
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
    new HtmlWebpackPlugin({
 | 
					    new HtmlWebpackPlugin({
 | 
				
			||||||
      excludeChunks: ['processTaskWorker'],
 | 
					      excludeChunks: ['processTaskWorker'],
 | 
				
			||||||
      filename: 'index.html',
 | 
					      filename: 'index.html',
 | 
				
			||||||
| 
						 | 
					@ -147,6 +149,20 @@ const config = {
 | 
				
			||||||
      images: path.join(__dirname, '../src/renderer/assets/img/'),
 | 
					      images: path.join(__dirname, '../src/renderer/assets/img/'),
 | 
				
			||||||
      static: path.join(__dirname, '../static/'),
 | 
					      static: path.join(__dirname, '../static/'),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    fallback: {
 | 
				
			||||||
 | 
					      buffer: require.resolve('buffer/'),
 | 
				
			||||||
 | 
					      dns: require.resolve('browserify/lib/_empty.js'),
 | 
				
			||||||
 | 
					      fs: require.resolve('browserify/lib/_empty.js'),
 | 
				
			||||||
 | 
					      http: require.resolve('stream-http'),
 | 
				
			||||||
 | 
					      https: require.resolve('https-browserify'),
 | 
				
			||||||
 | 
					      net: require.resolve('browserify/lib/_empty.js'),
 | 
				
			||||||
 | 
					      os: require.resolve('os-browserify/browser.js'),
 | 
				
			||||||
 | 
					      path: require.resolve('path-browserify'),
 | 
				
			||||||
 | 
					      stream: require.resolve('stream-browserify'),
 | 
				
			||||||
 | 
					      timers: require.resolve('timers-browserify'),
 | 
				
			||||||
 | 
					      tls: require.resolve('browserify/lib/_empty.js'),
 | 
				
			||||||
 | 
					      vm: require.resolve('vm-browserify')
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    extensions: ['.js', '.vue', '.json', '.css'],
 | 
					    extensions: ['.js', '.vue', '.json', '.css'],
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  target: 'web',
 | 
					  target: 'web',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +54,7 @@
 | 
				
			||||||
    "@freetube/yt-trending-scraper": "^3.1.1",
 | 
					    "@freetube/yt-trending-scraper": "^3.1.1",
 | 
				
			||||||
    "@silvermine/videojs-quality-selector": "^1.2.5",
 | 
					    "@silvermine/videojs-quality-selector": "^1.2.5",
 | 
				
			||||||
    "autolinker": "^4.0.0",
 | 
					    "autolinker": "^4.0.0",
 | 
				
			||||||
 | 
					    "browserify": "^17.0.0",
 | 
				
			||||||
    "electron-context-menu": "^3.5.0",
 | 
					    "electron-context-menu": "^3.5.0",
 | 
				
			||||||
    "http-proxy-agent": "^4.0.1",
 | 
					    "http-proxy-agent": "^4.0.1",
 | 
				
			||||||
    "https-proxy-agent": "^5.0.0",
 | 
					    "https-proxy-agent": "^5.0.0",
 | 
				
			||||||
| 
						 | 
					@ -63,6 +64,7 @@
 | 
				
			||||||
    "marked": "^4.0.17",
 | 
					    "marked": "^4.0.17",
 | 
				
			||||||
    "nedb-promises": "^5.0.1",
 | 
					    "nedb-promises": "^5.0.1",
 | 
				
			||||||
    "opml-to-json": "^1.0.1",
 | 
					    "opml-to-json": "^1.0.1",
 | 
				
			||||||
 | 
					    "process": "^0.11.10",
 | 
				
			||||||
    "rss-parser": "^3.12.0",
 | 
					    "rss-parser": "^3.12.0",
 | 
				
			||||||
    "socks-proxy-agent": "^6.0.0",
 | 
					    "socks-proxy-agent": "^6.0.0",
 | 
				
			||||||
    "video.js": "7.18.1",
 | 
					    "video.js": "7.18.1",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue