molecule icon indicating copy to clipboard operation
molecule copied to clipboard

How add extension for esm output ?

Open ZababurinSergei opened this issue 10 months ago • 0 comments

Hi !

The project has a ts to esm module conversion.

       "build": "gulp --gulpfile ./build/gulpfile.js",

tsConfig

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "lib": ["es5", "es6", "es7", "es2017", "dom", "ESNext"],
        "sourceMap": true,
        "allowJs": true,
        "jsx": "react",
        "moduleResolution": "node",
        "baseUrl": "./",
        "strict": true /* Enable all strict type-checking options. */,
        "forceConsistentCasingInFileNames": true,
        "noImplicitReturns": true,
        "noImplicitThis": true,
        "noImplicitAny": false,
        "strictNullChecks": true,
        "skipLibCheck": true,
        "suppressImplicitAnyIndexErrors": true,
        "noUnusedLocals": true,
        "noUnusedParameters": false,
        "declaration": true,
        "allowSyntheticDefaultImports": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "resolveJsonModule": true,
        "downlevelIteration": true,
        "paths": {
            "mo": ["./src/index.ts"],
            "mo/*": ["./src/*"],
            "@stories": ["./stories/*"],
            "@test/*": ["./test/*"]
        },
        "typeRoots": ["node", "node_modules/@types", "src/typings"]
    },
    "exclude": ["node_modules", "build", "scripts"]
}

But the output files do not have an extension and cannot be included in a project from esm directory.

import { Menu } from './../../components/menu';
import { mergeFunctions } from './../../common/utils';

How to add or can you add an option to tsConfig so that the output files have the extension ?

What would it be like this

import { Menu } from './../../components/menu/index.js';
import { mergeFunctions } from './../../common/utils/index.js';

ZababurinSergei avatar May 02 '24 09:05 ZababurinSergei