Skip to content

Commit

Permalink
fix: reduce bundle size by not bundling npm dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Demivan committed Feb 18, 2020
1 parent a07a8e3 commit 6faca34
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 10 deletions.
3 changes: 2 additions & 1 deletion examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"devDependencies": {
"@vue/component-compiler-utils": "^3.0.0",
"parcel-bundler": "^1.12.3"
}
},
"browserslist": ["last 1 Chrome versions"]
}
3 changes: 2 additions & 1 deletion examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"devDependencies": {
"@vue/component-compiler-utils": "^3.0.0",
"parcel-bundler": "^1.12.3"
}
},
"browserslist": ["last 1 Chrome versions"]
}
2 changes: 1 addition & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
{ file: pkg.module, format: 'es', sourcemap: true },
],
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: [],
external: ['cached-iterable', '@fluent/sequence'],
watch: {
include: 'src/**',
},
Expand Down
3 changes: 1 addition & 2 deletions src/fluent-vue.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Vue from 'vue'
import Vue, { VueConstructor } from 'vue'
import { CachedSyncIterable } from 'cached-iterable'
import { mapBundleSync } from '@fluent/sequence'
import { warn } from './util/warn'

import { VueConstructor } from 'vue/types/vue'
import { Pattern, FluentBundle } from '@fluent/bundle'
import { FluentVueObject, IUpdatable, FluentVueOptions } from './interfaces'

Expand Down
2 changes: 1 addition & 1 deletion src/install.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Vue } from 'vue/types/vue'
import Vue from 'vue'
import extend from './extend'
import mixin from './mixin'
import directive from './vue/directive'
Expand Down
18 changes: 15 additions & 3 deletions src/vue/component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import Vue from 'vue'
import { FunctionalComponentOptions } from 'vue'
import { RecordPropsDefinition } from 'vue/types/options'

export default Vue.extend({
interface ComponentProps {
path: string
tag?: string
args?: Record<string, unknown>
}

const component: FunctionalComponentOptions<
ComponentProps,
RecordPropsDefinition<ComponentProps>
> = {
name: 'i18n',
functional: true,
props: {
Expand Down Expand Up @@ -28,4 +38,6 @@ export default Vue.extend({

return h(props.tag, data, parts)
}
})
}

export default component
3 changes: 2 additions & 1 deletion src/vue/directive.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { DirectiveOptions } from 'vue'
import { DirectiveBinding } from 'vue/types/options'

import { warn } from '../util/warn'
import { FluentVueObject } from '../interfaces'
import { DirectiveBinding } from 'vue/types/options'

// This part is from fluent-dom library
const LOCALIZABLE_ATTRIBUTES = {
Expand Down

0 comments on commit 6faca34

Please sign in to comment.