diff --git a/.gitignore b/.gitignore index 3f6f8f5..2a241a4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ env.js dist/ lib/ .DS_Store +temp_types/ \.history/ diff --git a/.npmignore b/.npmignore index e11cf97..88d90f3 100644 --- a/.npmignore +++ b/.npmignore @@ -12,5 +12,6 @@ yarn-error.log env.js lib/ .DS_Store +temp_types/ \.history/ diff --git a/package.json b/package.json index 357741d..dfc64a7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "cloudinary-video-player-profiles", "version": "1.0.0", "description": "", - "main": "dist/main.js", + "module": "./lib/index.js", + "main": "./lib/index.js", "scripts": { "build": "NODE_ENV=production webpack" }, diff --git a/tsconfig.json b/tsconfig.json index a8e676c..65d331c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,14 @@ { "compilerOptions": { - "allowSyntheticDefaultImports": true, "baseUrl": ".", - "esModuleInterop": true, - "lib": ["ES2021"], - "module": "CommonJS", - "moduleResolution": "Node", - "noImplicitReturns": true, + "outDir": "./lib", + "allowSyntheticDefaultImports": true, + "module": "esnext", + "moduleResolution": "node", + "target": "es2020", + "declaration": true, "resolveJsonModule": true, - "sourceMap": true, - "skipLibCheck": true, - "strict": true, - "target": "ES2021" + "esModuleInterop": true }, "exclude": ["node_modules"] } diff --git a/webpack.config.js b/webpack.config.js index 205fad4..87505cc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,13 +1,20 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); const path = require('path'); -const outputPath = path.resolve(__dirname, './dist'); +const outputPath = path.resolve(__dirname, './lib'); module.exports = { mode: 'production', - entry: './src/index.ts', + entry: { + 'index': './src/index.ts', + }, + devtool: 'source-map', output: { - filename: `[name].js`, - path: outputPath + filename: '[name].js', + path: outputPath, + publicPath: '', + library: { + type: 'module' + }, }, resolve: { extensions: ['.ts', '.tsx', '.json'], @@ -18,7 +25,7 @@ module.exports = { { test: /\.tsx?$/i, exclude: /node_modules/, - use: ['ts-loader'], + loader: 'ts-loader', } ] }, @@ -30,4 +37,7 @@ module.exports = { }] }) ], + experiments: { + outputModule: true + } };