-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(internal): update config based on embroider-build/embroider#1106
- Loading branch information
1 parent
2f513d2
commit 4ae8d86
Showing
3 changed files
with
2,542 additions
and
3,335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,62 @@ | ||
// @ts-nocheck | ||
import babel from '@rollup/plugin-babel'; | ||
import { defineConfig } from 'rollup'; | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
import ts from 'rollup-plugin-ts'; | ||
|
||
import { Addon } from '@embroider/addon-dev/rollup'; | ||
|
||
const addon = new Addon(); | ||
|
||
const extensions = ['.js', '.ts', '.hbs']; | ||
|
||
const transpilation = [ | ||
// Instruct rollup how to resolve ts and hbs imports | ||
// (importing a template-only component, for example) | ||
nodeResolve({ resolveOnly: ['./'], extensions }), | ||
|
||
// 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. | ||
// See `babel.config.json` for the actual Babel configuration! | ||
babel({ babelHelpers: 'bundled', extensions }), | ||
|
||
// Follow the V2 Addon rules about dependencies. Your code can import from | ||
// `dependencies` and `peerDependencies` as well as standard Ember-provided | ||
// package names. | ||
addon.dependencies(), | ||
|
||
// 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']), | ||
]; | ||
const addon = new Addon({ | ||
srcDir: 'src', | ||
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/**/*.js', 'instance-initializers/*.js', 'helpers/**/*.js']; | ||
|
||
export default defineConfig({ | ||
input: ['src/index.ts'], | ||
output: { | ||
sourcemap: true, | ||
format: 'es', | ||
dir: 'dist', | ||
}, | ||
output: addon.output(), | ||
plugins: [ | ||
...transpilation, | ||
// 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. | ||
// See `babel.config.json` for the actual Babel configuration! | ||
ts({ | ||
// can be changed to swc or other transpilers later | ||
// but we need the ember plugins converted first | ||
// (template compilation and co-location) | ||
transpiler: 'babel', | ||
browserslist: ['last 2 firefox versions', 'last 2 chrome versions'], | ||
// setting this true greatly improves performance, but | ||
// at the cost of safety. | ||
transpileOnly: false, | ||
tsconfig: { | ||
fileName: 'tsconfig.json', | ||
hook: (config) => ({ ...config, declaration: true }), | ||
}, | ||
}), | ||
|
||
// Follow the V2 Addon rules about dependencies. Your code can import from | ||
// `dependencies` and `peerDependencies` as well as standard Ember-provided | ||
// package names. | ||
addon.dependencies(), | ||
|
||
// These are the modules that users should be able to import from your | ||
// addon. Anything not listed here may get optimized away. | ||
addon.publicEntrypoints(['index.js']), | ||
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([]), | ||
|
||
// 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']), | ||
|
||
addon.clean(), | ||
], | ||
}); |
Oops, something went wrong.