diff --git a/ember-statechart-component/config/rollup.config.js b/ember-statechart-component/config/rollup.config.js index 91a066ef..ca0420e0 100644 --- a/ember-statechart-component/config/rollup.config.js +++ b/ember-statechart-component/config/rollup.config.js @@ -3,10 +3,8 @@ import path from 'path'; import alias from '@rollup/plugin-alias'; import multiInput from 'rollup-plugin-multi-input'; -import babel from '@rollup/plugin-babel'; import ts from 'rollup-plugin-ts'; import { defineConfig } from 'rollup'; -import { nodeResolve } from '@rollup/plugin-node-resolve'; import { Addon } from '@embroider/addon-dev/rollup'; @@ -14,14 +12,12 @@ import babelConfig from './babel.config'; import packageJson from '../package.json'; -const addon = new Addon(); - -const extensions = ['.js', '.ts']; +const addon = new Addon({ + srcDir: 'src', + destDir: 'dist', +}); const transpilation = [ - // Instruct rollup how to resolve ts and hbs imports - // (importing a template-only component, for example) - nodeResolve({ resolveOnly: ['./'], extensions: [...extensions, '.hbs'] }), // Allow top-level imports (what folks are used to from v1 addons) // During the build, anything referencing a top-level import will be @@ -78,27 +74,20 @@ const transpilation = [ // addon.keepAssets(['**/*.css']), ]; -// these should be JS, even though the authored format is TS -const globallyAvailable = ['index.js', 'instance-initializers/ember-statechart-component.js']; - export default defineConfig({ - input: ['src/**/*{js,hbs,ts}'], - output: { - format: 'es', - dir: 'dist', - }, + output: addon.output(), plugins: [ multiInput(), ...transpilation, // These are the modules that users should be able to import from your // addon. Anything not listed here may get optimized away. - addon.publicEntrypoints([...globallyAvailable]), + addon.publicEntrypoints(['*.{js,ts}', 'instance-initializers/*.{js,ts}']), // These are the modules that should get reexported into the traditional // "app" tree. Things in here should also be in publicEntrypoints above, but // not everything in publicEntrypoints necessarily needs to go here. - addon.appReexports([...globallyAvailable]), + addon.appReexports(['instance-initializers/*.{js,ts}']), addon.clean(), ], diff --git a/ember-statechart-component/package.json b/ember-statechart-component/package.json index f124abaa..f10430df 100644 --- a/ember-statechart-component/package.json +++ b/ember-statechart-component/package.json @@ -100,7 +100,6 @@ "type": "addon", "main": "./config/addon-main.cjs", "app-js": { - "./index.js": "./dist/_app_/index.js", "./instance-initializers/ember-statechart-component.js": "./dist/_app_/instance-initializers/ember-statechart-component.js" } },