Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack bundle dependencies #2511

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions _scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,14 @@ const config = {
'icon.svg',
'./dist/**/*',
'!dist/web/*',
'!**/node_modules/**/.*',
'!**/node_modules/**/index.html',
'!**/{.github,Jenkinsfile}',
'!**/{CHANGES.md,CODE_OF_CONDUCT.md,CONTRIBUTING.md,CONTRIBUTION.md,DEVELOPMENT.md,docs,docs.md,docs.mli,examples,History.md,HISTORY.md,README.md,TODO.md,UPGRADE_GUIDE.md,UPGRADING.md}',
'!**/{commitlint.config.js,.editorconfig,.eslintignore,.eslintrc.{js,yml},.gitmodules,.huskyrc,.lintstagedrc,.nvmrc,.nycrc{,.json},.prettierrc{,.yaml},tslint.json}',
'!**/{.babelrc,bower.json,Gruntfile.js,Makefile,.npmrc.proregistry,rollup.config.js,.tm_properties,.tool-versions,tsconfig.json,webpack.config.js}',
'!**/*.{{,c,m}js,min,ts}.map',
'!**/*.d.ts',
'!node_modules/**/*',

// renderer
'node_modules/{miniget,ytpl,ytsr}/**/*',

// only exclude the src directory for specific packages
// as some of them have their dist code in there and we don't want to exclude those
'!**/node_modules/{@fortawesome/vue-fontawesome,agent-base,jquery,localforage,m3u8-parser,marked,mpd-parser,performance-now,video.js,vue,vue-i18n,vue-router}/src/*',
'!**/node_modules/**/{bin,man,scripts}/*',
'!**/node_modules/jquery/dist/jquery.slim*.js',
'!**/node_modules/video.js/dist/{alt/*,video.js}',
'!**/node_modules/@videojs/*/src'
'!**/README.md',
'!**/*.js.map',
'!**/*.d.ts',
],
dmg: {
contents: [
Expand Down
13 changes: 5 additions & 8 deletions _scripts/webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@ const path = require('path')
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')

const {
dependencies,
devDependencies,
productName,
} = require('../package.json')
const { productName } = require('../package.json')

const externals = Object.keys(dependencies).concat(Object.keys(devDependencies))
const isDevMode = process.env.NODE_ENV === 'development'
const whiteListedModules = []

const config = {
name: 'main',
Expand All @@ -19,7 +13,10 @@ const config = {
entry: {
main: path.join(__dirname, '../src/main/index.js'),
},
externals: externals.filter(d => !whiteListedModules.includes(d)),
// webpack spits out errors while inlining electron-debug as
// it tries to dynamically load dependencies
// the error: "Critical dependency: the request of a dependency is an expression"
externals: ['electron-debug'],
module: {
rules: [
{
Expand Down
13 changes: 5 additions & 8 deletions _scripts/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ const VueLoaderPlugin = require('vue-loader/lib/plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

const {
dependencies,
devDependencies,
productName,
} = require('../package.json')
const { productName } = require('../package.json')

const externals = Object.keys(dependencies).concat(Object.keys(devDependencies))
const isDevMode = process.env.NODE_ENV === 'development'
const whiteListedModules = ['vue']

const config = {
name: 'renderer',
Expand All @@ -33,7 +27,10 @@ const config = {
path: path.join(__dirname, '../dist'),
filename: '[name].js',
},
externals: externals.filter(d => !whiteListedModules.includes(d)),
// webpack spits out errors while inlining ytpl and ytsr as
// they dynamically import their package.json file to extract the bug report URL
// the error: "Critical dependency: the request of a dependency is an expression"
externals: ['ytpl', 'ytsr'],
module: {
rules: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class="bubble selected"
>
<font-awesome-icon
icon="check"
:icon="['fas', 'check']"
class="icon"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/ft-icon-button/ft-icon-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default Vue.extend({
default: ''
},
icon: {
type: String,
default: 'ellipsis-v'
type: Array,
default: () => ['fas', 'ellipsis-v']
},
theme: {
type: String,
Expand Down
10 changes: 5 additions & 5 deletions src/renderer/components/ft-input/ft-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default Vue.extend({
// As the text input box should be empty
clearTextButtonExisting: false,
clearTextButtonVisible: false,
actionButtonIconName: 'search'
actionButtonIconName: ['fas', 'search']
}
},
computed: {
Expand Down Expand Up @@ -136,7 +136,7 @@ export default Vue.extend({

if (!this.inputDataPresent) {
// Change back to default icon if text is blank
this.actionButtonIconName = 'search'
this.actionButtonIconName = ['fas', 'search']
return
}

Expand Down Expand Up @@ -165,15 +165,15 @@ export default Vue.extend({

if (isYoutubeLink) {
// Go to URL (i.e. Video/Playlist/Channel
this.actionButtonIconName = 'arrow-right'
this.actionButtonIconName = ['fas', 'arrow-right']
} else {
// Search with text
this.actionButtonIconName = 'search'
this.actionButtonIconName = ['fas', 'search']
}
})
} catch (ex) {
// On exception, consider text as invalid URL
this.actionButtonIconName = 'search'
this.actionButtonIconName = ['fas', 'search']
// Rethrow exception
throw ex
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-input/ft-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</label>
<font-awesome-icon
v-if="showClearTextButton"
icon="times-circle"
:icon="['fas', 'times-circle']"
class="clearInputTextButton"
:class="{
visible: inputDataPresent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ title }}
<font-awesome-icon
class="angleDownIcon"
icon="angle-down"
:icon="['fas', 'angle-down']"
/>
</div>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/ft-list-playlist/ft-list-playlist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<div class="background" />
<div class="inner">
<div>{{ videoCount }}</div>
<div><font-awesome-icon icon="list" /></div>
<div><font-awesome-icon :icon="['fas','list']" /></div>
</div>
</div>
</router-link>
<div class="info">
<ft-icon-button
v-if="externalPlayer !== ''"
:title="$t('Video.External Player.OpenInTemplate').replace('$', externalPlayer)"
icon="external-link-alt"
:icon="['fas', 'external-link-alt']"
class="externalPlayerButton"
theme="base-no-default"
:size="16"
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/components/ft-list-video/ft-list-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<ft-icon-button
v-if="externalPlayer !== ''"
:title="$t('Video.External Player.OpenInTemplate').replace('$', externalPlayer)"
icon="external-link-alt"
:icon="['fas', 'external-link-alt']"
class="externalPlayerIcon"
theme="base"
:padding="appearance === `watchPlaylistItem` ? 6 : 7"
Expand All @@ -44,7 +44,7 @@
<ft-icon-button
v-if="!isLive"
:title="$t('Video.Save Video')"
icon="star"
:icon="['fas', 'star']"
class="favoritesIcon"
:theme="favoriteIconTheme"
:padding="appearance === `watchPlaylistItem` ? 5 : 6"
Expand All @@ -66,7 +66,7 @@
<div class="info">
<ft-icon-button
class="optionsButton"
icon="ellipsis-v"
:icon="['fas', 'ellipsis-v']"
title="More Options"
theme="base-no-default"
:size="16"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
<font-awesome-icon
class="bannerIcon"
icon="times"
:icon="['fas', 'times']"
@click="handleClose"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</h3>
<ft-icon-button
class="profileSettings"
icon="sliders-h"
:icon="['fas', 'sliders-h']"
@click="openProfileSettings"
/>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-select/ft-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</option>
</select>
<font-awesome-icon
icon="sort-down"
:icon="['fas', 'sort-down']"
class="iconSelect"
/>
<span class="select-highlight" />
Expand Down
18 changes: 9 additions & 9 deletions src/renderer/components/ft-share-button/ft-share-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ref="iconButton"
:title="$t('Share.Share Video')"
theme="secondary"
icon="share-alt"
:icon="['fas', 'share-alt']"
dropdown-position-x="left"
:force-dropdown="true"
>
Expand Down Expand Up @@ -31,30 +31,30 @@
class="action"
@click="copyYoutube()"
>
<font-awesome-icon icon="copy" />
<font-awesome-icon :icon="['fas', 'copy']" />
{{ $t("Share.Copy Link") }}
</ft-button>
<ft-button
class="action"
@click="openYoutube()"
>
<font-awesome-icon icon="globe" />
<font-awesome-icon :icon="['fas', 'globe']" />
{{ $t("Share.Open Link") }}
</ft-button>
<ft-button
class="action"
background-color="var(--accent-color-active)"
@click="copyYoutubeEmbed()"
>
<font-awesome-icon icon="copy" />
<font-awesome-icon :icon="['fas', 'copy']" />
{{ $t("Share.Copy Embed") }}
</ft-button>
<ft-button
class="action"
background-color="var(--accent-color-active)"
@click="openYoutubeEmbed()"
>
<font-awesome-icon icon="globe" />
<font-awesome-icon :icon="['fas', 'globe']" />
{{ $t("Share.Open Embed") }}
</ft-button>
</div>
Expand All @@ -70,30 +70,30 @@
class="action"
@click="copyInvidious()"
>
<font-awesome-icon icon="copy" />
<font-awesome-icon :icon="['fas', 'copy']" />
{{ $t("Share.Copy Link") }}
</ft-button>
<ft-button
class="action"
@click="openInvidious()"
>
<font-awesome-icon icon="globe" />
<font-awesome-icon :icon="['fas', 'globe']" />
{{ $t("Share.Open Link") }}
</ft-button>
<ft-button
class="action"
background-color="var(--accent-color-active)"
@click="copyInvidiousEmbed()"
>
<font-awesome-icon icon="copy" />
<font-awesome-icon :icon="['fas', 'copy']" />
{{ $t("Share.Copy Embed") }}
</ft-button>
<ft-button
class="action"
background-color="var(--accent-color-active)"
@click="openInvidiousEmbed()"
>
<font-awesome-icon icon="globe" />
<font-awesome-icon :icon="['fas', 'globe']" />
{{ $t("Share.Open Embed") }}
</ft-button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-tooltip/ft-tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class="button"
type="button"
>
<font-awesome-icon icon="question-circle" />
<font-awesome-icon :icon="['fas', 'question-circle']" />
</button>
<p
:id="id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@click="openMoreOptions = !openMoreOptions"
>
<font-awesome-icon
icon="ellipsis-h"
:icon="['fas', 'ellipsis-h']"
class="navIcon"
:class="applyNavIconExpand"
/>
Expand All @@ -32,7 +32,7 @@
class="thumbnailContainer"
>
<font-awesome-icon
icon="list"
:icon="['fas', 'list']"
class="navIcon"
:class="applyNavIconExpand"
fixed-width
Expand All @@ -52,7 +52,7 @@
@click="navigate('trending')"
>
<font-awesome-icon
icon="fire"
:icon="['fas', 'fire']"
class="navIcon"
:class="applyNavIconExpand"
/>
Expand All @@ -70,7 +70,7 @@
@click="navigate('popular')"
>
<font-awesome-icon
icon="users"
:icon="['fas', 'users']"
class="navIcon"
:class="applyNavIconExpand"
/>
Expand All @@ -87,7 +87,7 @@
@click="navigate('about')"
>
<font-awesome-icon
icon="info-circle"
:icon="['fas', 'info-circle']"
class="navIcon"
:class="applyNavIconExpand"
/>
Expand All @@ -104,7 +104,7 @@
@click="navigate('history')"
>
<font-awesome-icon
icon="history"
:icon="['fas', 'history']"
class="navIcon"
:class="applyNavIconExpand"
/>
Expand All @@ -118,7 +118,7 @@
@click="navigate('settings')"
>
<font-awesome-icon
icon="sliders-h"
:icon="['fas', 'sliders-h']"
class="navIcon"
:class="applyNavIconExpand"
/>
Expand All @@ -131,7 +131,7 @@
@click="navigate('about')"
>
<font-awesome-icon
icon="info-circle"
:icon="['fas', 'info-circle']"
class="navIcon"
:class="applyNavIconExpand"
/>
Expand Down
Loading