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
3 changed files with 16 additions and 4 deletions
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";
|
import * as pkg from "off-color";
|
||||||
const {offColor} = pkg;
|
// @ts-ignore
|
||||||
|
const offColor = pkg.offColor ?? pkg.default.offColor;
|
||||||
|
|
||||||
export function tests() {
|
export function tests() {
|
||||||
return {
|
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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import pkg from 'off-color';
|
import * as pkg from 'off-color';
|
||||||
const offColor = pkg.offColor;
|
const offColor = pkg.offColor ?? pkg.default.offColor;
|
||||||
|
|
||||||
export function derive(value, operation, argument, isDark) {
|
export function derive(value, operation, argument, isDark) {
|
||||||
const argumentAsNumber = parseInt(argument);
|
const argumentAsNumber = parseInt(argument);
|
||||||
|
|
Reference in a new issue