Skip to content

Commit

Permalink
feat(components): external @tarojs/taro
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Dec 16, 2021
1 parent 2bb526c commit 054e4db
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Component, Prop, h, ComponentInterface, Host, Listen, Event, EventEmitter } from '@stencil/core'
import Taro from '@tarojs/taro'
import classNames from 'classnames'

const Taro = require('@tarojs/taro')

/**
* Navigator组件参数
* @typedef NavigatorProps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Component, Prop, h, ComponentInterface, Host, State, Event, EventEmitter, Watch, Element } from '@stencil/core'
import Taro from '@tarojs/taro'
import classNames from 'classnames'

const Taro = require('@tarojs/taro')

function setTransform (nodeStyle, value) {
nodeStyle.transform = value
nodeStyle.webkitTransform = value
Expand Down
3 changes: 1 addition & 2 deletions packages/taro-components/src/components/tabbar/tabbar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Component, Prop, h, ComponentInterface, Host, State, Event, EventEmitter, Element } from '@stencil/core'
import Taro from '@tarojs/taro'
import classNames from 'classnames'
import resolvePathname from 'resolve-pathname'

import { splitUrl } from '../../utils'
import { TabbarItem } from './tabbar-item'

const Taro = require('@tarojs/taro')

// const removeLeadingSlash = str => str.replace(/^\.?\//, '')
// const removeTrailingSearch = str => str.replace(/\?[\s\S]*$/, '')
const addLeadingSlash = str => str[0] === '/' ? str : `/${str}`
Expand Down
11 changes: 11 additions & 0 deletions packages/taro-components/stencil.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Config } from '@stencil/core'
import { sass } from '@stencil/sass'

const { jsWithTs: tsjPreset } = require('ts-jest/presets')

export const config: Config = {
Expand Down Expand Up @@ -50,5 +51,15 @@ export const config: Config = {
emulate: [{
device: 'iPhone 8'
}]
},
rollupPlugins: {
after: [{
name: 'add-external',
options: opts => {
opts.external = ['@tarojs/taro']

return opts
}
}]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
/* eslint-disable no-case-declarations */
/* eslint-disable no-void */
/* eslint-disable no-return-assign */
import Taro from '@tarojs/taro'
import { getRTLOffsetType } from '../domHelpers'
import { memoizeOne } from '../memoize'
import { createElement, PureComponent } from 'react'
import { cancelTimeout, requestTimeout } from '../timer'

const Taro = require('@tarojs/taro')

const IS_SCROLLING_DEBOUNCE_INTERVAL = 200

const defaultItemKey = (index) => index // In DEV mode, this Set helps us only log a warning once per component instance.
Expand Down

0 comments on commit 054e4db

Please sign in to comment.