Skip to content

Commit

Permalink
Update rollup config -- tests won't pass until: embroider-build/embro…
Browse files Browse the repository at this point in the history
…ider#1126 is released
  • Loading branch information
NullVoxPopuli committed Feb 18, 2022
1 parent bc04cf5 commit 059cf97
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions my-addon/config/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @ts-nocheck
import ts from 'rollup-plugin-ts';
import { defineConfig } from 'rollup';
import { nodeResolve } from '@rollup/plugin-node-resolve';

import { Addon } from '@embroider/addon-dev/rollup';

Expand All @@ -10,31 +9,20 @@ const addon = new Addon({
destDir: 'dist',
});

// these should be JS, even though the authored format is TS
// Unfortunately, your local project layout has to kind of match what classic ember expects
// so that all the app-re-exports can be properly generated
const globallyAvailable = [
'components/**/*.{ts,js}',
'instance-initializers/*.{ts,js}',
'helpers/**/*.{ts,js}',
];

export default defineConfig({
external: ['tslib', 'ember-cli-htmlbars', '@glimmer/tracking', '@glimmer/component'],
output: addon.output(),
plugins: [
// Instruct rollup how to resolve ts and hbs imports
// (importing a template-only component, for example)
nodeResolve({ extensions: [ '.gjs', '.gts', '.js', '.ts', '.hbs']}),

// These are the modules that users should be able to import from your
// addon. Anything not listed here may get optimized away.
addon.publicEntrypoints(['*.{js,ts}', ...globallyAvailable]),
addon.publicEntrypoints(['**/*.{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([
'components/**/*.{js,ts}', 'helpers/**/*.{js,ts}', 'modifiers/**/*.{js,ts}',
'initializers/**/*.{js,ts}', 'instance-initializers/**/*.{js,ts}'
]),
// This babel config should *not* apply presets or compile away ES modules.
// It exists only to provide development niceties for you, like automatic
// template colocation.
Expand All @@ -44,11 +32,7 @@ export default defineConfig({
// but we need the ember plugins converted first
// (template compilation and co-location)
transpiler: 'babel',
// include: '**/*.{js,ts,hbs}',
browserslist: ['last 2 firefox versions', 'last 2 chrome versions'],
// setting this true greatly improves performance, but
// at the cost of safety.
transpileOnly: true,
tsconfig: {
fileName: 'tsconfig.json',
hook: (config) => ({ ...config, declaration: true }),
Expand All @@ -63,9 +47,9 @@ export default defineConfig({
// Ensure that standalone .hbs files are properly integrated as Javascript.
addon.hbs(),

// addons are allowed to contain imports of .css files, which we want rollup
// to leave alone and keep in the published output.
// addon.keepAssets(['**/*.css']),
// addons are allowed to contain imports of .css files, which we want rollup
// to leave alone and keep in the published output.
// addon.keepAssets(['**/*.css']),

addon.clean(),
],
Expand Down

0 comments on commit 059cf97

Please sign in to comment.