Update configuration to output types

This commit is contained in:
Matt Triff 2021-12-26 16:37:23 -05:00
parent 0b6973b322
commit bf94386cc5
4 changed files with 13 additions and 2 deletions

View file

@ -3,7 +3,7 @@
"version": "9.1.0", "version": "9.1.0",
"description": "A vanilla JS customisable text input/select box plugin", "description": "A vanilla JS customisable text input/select box plugin",
"main": "./public/assets/scripts/choices.js", "main": "./public/assets/scripts/choices.js",
"types": "./types/index.d.ts", "types": "./public/types/src/index.d.ts",
"scripts": { "scripts": {
"start": "run-p js:watch css:watch", "start": "run-p js:watch css:watch",
"build": "run-p js:build css:build", "build": "run-p js:build css:build",

7
src/index.ts Normal file
View file

@ -0,0 +1,7 @@
import Choices from './scripts/choices';
export * from './scripts/constants';
export * from './scripts/defaults';
export { default as templates } from './scripts/templates';
export default Choices;

View file

@ -3,8 +3,12 @@
"baseUrl": "/", "baseUrl": "/",
"outDir": "./dist/", "outDir": "./dist/",
"allowJs": true, "allowJs": true,
"declaration": true,
"declarationDir": "./public/types/",
"declarationMap": true,
"sourceMap": true, "sourceMap": true,
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true, "esModuleInterop": true,
"target": "es5", "target": "es5",
"lib": ["es2017", "dom"], "lib": ["es2017", "dom"],

View file

@ -8,7 +8,7 @@ const exclude = /node_modules/;
* @type {import('webpack').Configuration} * @type {import('webpack').Configuration}
*/ */
module.exports = { module.exports = {
entry: ['./src/scripts/choices'], entry: ['./src/index'],
module: { module: {
rules: [ rules: [
{ {