Skip to content

Commit

Permalink
use exports
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Sep 13, 2023
1 parent 1ded897 commit 64bde71
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
12 changes: 12 additions & 0 deletions build/fix-esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
//@ts-check

const fs = require('fs');

const pkg = { type: 'module' };

fs.writeFileSync('lib/esm/package.json', JSON.stringify(pkg, undefined, 2) + '\n');
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
"description": "Language service for CSS, LESS and SCSS",
"main": "./lib/umd/cssLanguageService.js",
"typings": "./lib/umd/cssLanguageService",
"module": "./lib/esm/cssLanguageService.js",
"exports": {
".": {
"import": "./lib/esm/cssLanguageService.js",
"default": "./lib/umd/cssLanguageService.js"
}
},
"author": "Microsoft Corporation",
"repository": {
"type": "git",
Expand Down Expand Up @@ -36,7 +41,7 @@
"scripts": {
"prepack": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
"compile": "tsc -p ./src && npm run copy-jsbeautify && npm run lint ",
"compile-esm": "tsc -p ./src/tsconfig.esm.json",
"compile-esm": "tsc -p ./src/tsconfig.esm.json && node ./build/fix-esm.js",
"clean": "rimraf lib",
"remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js",
"watch": "npm run copy-jsbeautify && tsc -w -p ./src",
Expand Down
4 changes: 2 additions & 2 deletions src/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es2020",
"module": "es6",
"target": "es6",
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
Expand Down

0 comments on commit 64bde71

Please sign in to comment.