mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Merge pull request #824 from vector-im/fix-dev-server-1
Fix develop server breaking due to import syntax
This commit is contained in:
commit
7d3f22c106
11
doc/IMPORT-ISSUES.md
Normal file
11
doc/IMPORT-ISSUES.md
Normal file
@ -0,0 +1,11 @@
|
||||
## How to import common-js dependency using ES6 syntax
|
||||
---
|
||||
Until [#6632](https://github.com/vitejs/vite/issues/6632) is fixed, such imports should be done as follows:
|
||||
|
||||
```ts
|
||||
import * as pkg from "off-color";
|
||||
// @ts-ignore
|
||||
const offColor = pkg.offColor ?? pkg.default.offColor;
|
||||
```
|
||||
|
||||
This way build, dev server and unit tests should all work.
|
@ -98,8 +98,9 @@ export class DerivedVariables {
|
||||
}
|
||||
}
|
||||
|
||||
import pkg from "off-color";
|
||||
const {offColor} = pkg;
|
||||
import * as pkg from "off-color";
|
||||
// @ts-ignore
|
||||
const offColor = pkg.offColor ?? pkg.default.offColor;
|
||||
|
||||
export function tests() {
|
||||
return {
|
||||
|
@ -13,8 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import pkg from 'off-color';
|
||||
const offColor = pkg.offColor;
|
||||
import * as pkg from 'off-color';
|
||||
const offColor = pkg.offColor ?? pkg.default.offColor;
|
||||
|
||||
export function derive(value, operation, argument, isDark) {
|
||||
const argumentAsNumber = parseInt(argument);
|
||||
|
Loading…
Reference in New Issue
Block a user