Skip to content

Commit 64bde71

Browse files
committed
use exports
1 parent 1ded897 commit 64bde71

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

build/fix-esm.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
'use strict';
6+
//@ts-check
7+
8+
const fs = require('fs');
9+
10+
const pkg = { type: 'module' };
11+
12+
fs.writeFileSync('lib/esm/package.json', JSON.stringify(pkg, undefined, 2) + '\n');

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"description": "Language service for CSS, LESS and SCSS",
55
"main": "./lib/umd/cssLanguageService.js",
66
"typings": "./lib/umd/cssLanguageService",
7-
"module": "./lib/esm/cssLanguageService.js",
7+
"exports": {
8+
".": {
9+
"import": "./lib/esm/cssLanguageService.js",
10+
"default": "./lib/umd/cssLanguageService.js"
11+
}
12+
},
813
"author": "Microsoft Corporation",
914
"repository": {
1015
"type": "git",
@@ -36,7 +41,7 @@
3641
"scripts": {
3742
"prepack": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
3843
"compile": "tsc -p ./src && npm run copy-jsbeautify && npm run lint ",
39-
"compile-esm": "tsc -p ./src/tsconfig.esm.json",
44+
"compile-esm": "tsc -p ./src/tsconfig.esm.json && node ./build/fix-esm.js",
4045
"clean": "rimraf lib",
4146
"remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js",
4247
"watch": "npm run copy-jsbeautify && tsc -w -p ./src",

src/tsconfig.esm.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"target": "es2020",
4-
"module": "es6",
3+
"target": "es6",
4+
"module": "esnext",
55
"moduleResolution": "node",
66
"sourceMap": true,
77
"declaration": true,

0 commit comments

Comments
 (0)