diff --git a/__tests__/demo/demo-components/index.js b/__tests__/demo/demo-components/index.js index 7719f1a7..c4de6ae2 100644 --- a/__tests__/demo/demo-components/index.js +++ b/__tests__/demo/demo-components/index.js @@ -1,7 +1,10 @@ import React, { useState, useRef } from 'react'; // root of this project -import MaterialTable, { MTableBodyRow, MTableEditRow } from '../../../src'; +import MaterialTable, { + MTableBodyRow, + MTableEditRow +} from '../../../dist_esbuild'; export { default as EditableRowDateColumnIssue } from './EditableRowDateColumnIssue'; diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index f1d30615..00000000 --- a/babel.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - presets: ['@babel/preset-env', '@babel/react'], - plugins: [ - '@babel/plugin-transform-runtime', - '@babel/plugin-proposal-class-properties', - '@babel/plugin-proposal-object-rest-spread' - ] -}; diff --git a/esbuild.config.js b/esbuild.config.js index 3c515890..a5afc957 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -1,17 +1,3 @@ -/** - - - - * THIS FILE IS NOT IN USE RIGHT NOW - * We had issues using esbuild - I just need to revisit - * (I think the root of the issue wasn't even esbuild so we - * may just need to publish a test pkg using it) - - - * - oze4 - - - */ - const { build } = require('esbuild'); const { red, green, yellow, italic } = require('chalk'); const rimraf = require('rimraf'); @@ -21,7 +7,14 @@ const fs = require('fs'); const { log } = console; const { stdout, stderr, exit } = process; -const BUILD_DIR = 'dist'; // relative to root of project (no trailing slash) +/** + * OUTPUT PATH IS SET HERE!! + * + * relative to root of project + * + * !! NO TRAILING SLASH !! + */ +const BUILD_DIR = 'dist'; stdout.write(yellow(`-Cleaning build artifacts from : '${BUILD_DIR}' `)); @@ -35,10 +28,12 @@ rimraf(path.resolve(__dirname, BUILD_DIR), async (error) => { const options = { entryPoints: getFilesRecursive('./src', '.js'), + minifySyntax: true, minify: true, bundle: false, outdir: `${BUILD_DIR}`, - format: 'cjs', + target: 'es6', + // format: 'cjs', loader: { '.js': 'jsx' } diff --git a/package.json b/package.json index e012ab8d..ad293a26 100644 --- a/package.json +++ b/package.json @@ -7,19 +7,16 @@ "version": "3.2.5", "description": "Datatable for React based on https://material-ui.com/api/table/ with additional features", "main": "dist/index.js", + "type": "module", "types": "types/index.d.ts", "files": [ "dist", "types" ], - "babel": { - "extends": "./babel.config.js" - }, "scripts": { "start": "./node_modules/.bin/webpack serve --config ./__tests__/demo/webpack.config.js --mode development --progress", "build:esbuild": "node esbuild.config.js", - "build": "npm run build:root", - "build:root": "./node_modules/.bin/babel src -d dist", + "build": "npm run build:esbuild", "lint": "npm run eslint && npm run tsc", "eslint": "./node_modules/.bin/eslint src/** -c ./.eslintrc --ignore-path ./.eslintignore", "tsc": "./node_modules/.bin/tsc --noEmit --lib es6,dom --skipLibCheck types/index.d.ts",