Skip to content

Commit

Permalink
wip: complied output looks good with embroider-build/embroider#1106, …
Browse files Browse the repository at this point in the history
…but this was orthogonal to the peer dep issue, and I should have tested this on a separate addon
  • Loading branch information
NullVoxPopuli committed Feb 3, 2022
1 parent 295e7b5 commit 6ec0589
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
25 changes: 7 additions & 18 deletions ember-statechart-component/config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,21 @@ 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';

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
Expand Down Expand Up @@ -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(),
],
Expand Down
1 change: 0 additions & 1 deletion ember-statechart-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand Down

0 comments on commit 6ec0589

Please sign in to comment.