Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect where modules loop back to AMD from webpack #574

Merged
merged 5 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: volta-cli/action@v4
with:
node-version: '14'
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -44,7 +44,7 @@ jobs:
- uses: volta-cli/action@v4
with:
node-version: '14'
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -63,7 +63,7 @@ jobs:
- uses: volta-cli/action@v4
with:
node-version: '14'
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -82,7 +82,7 @@ jobs:
# - uses: volta-cli/action@v4
# with:
# node-version: '14'
# - uses: actions/cache@v2
# - uses: actions/cache@v3
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand Down
1 change: 0 additions & 1 deletion packages/ember-auto-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ let app = new EmberApp(defaults, {
Supported Options

- `alias`: _object_, Map from imported names to substitute names that will be imported instead. This is a prefix match by default. To opt out of prefix-matching and only match exactly, add a `$` suffix to the pattern.
- `earlyBootSet`: _function, returning an array of strings_, (only supported on ember-source >= 3.27.0) defaults to undefined, but when used, the function will receive the default earlyBootSet, which is a list of common modules found at the source of rare timing / package / ordering issues in the compatibility / cross-communication between requirejs and webpack. This is a temporary escape hatch to allow non-embroider apps to consume v2 addons at any place in their dependency graph to help ease transitioning to embroider as this problem doesn't occur once an app is using embroider. See [issue#504](https://github.com/ef4/ember-auto-import/issues/504) for details. Note that if any modules listed here belong to v2 addons, they will be removed from the set. To opt out of default behavior, return an empty array.
- `exclude`: _list of strings, defaults to []_. Packages in this list will be ignored by ember-auto-import. Can be helpful if the package is already included another way (like a shim from some other Ember addon).
- `forbidEval`: _boolean_, defaults to false. We use `eval` in development by default (because that is the fastest way to provide sourcemaps). If you need to comply with a strict Content Security Policy (CSP), you can set `forbidEval: true`. You will still get sourcemaps, they will just use a slower implementation.
- `insertScriptsAt`: _string_, defaults to undefined. Optionally allows you to take manual control over where ember-auto-import's generated `<script>` tags will be inserted into your HTML and what attributes they will have. See "Customizing HTML Insertion" below.
Expand Down
1 change: 0 additions & 1 deletion packages/ember-auto-import/ts/auto-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export default class AutoImport implements AutoImportSharedAPI {
publicAssetURL: this.rootPackage.publicAssetURL(),
webpack,
hasFastboot: this.rootPackage.isFastBootEnabled,
earlyBootSet: this.rootPackage.earlyBootSet,
v2Addons: this.v2Addons,
rootPackage: this.rootPackage,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-auto-import/ts/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export interface BundlerOptions {
browserslist: string;
webpack: typeof webpack;
hasFastboot: boolean;
earlyBootSet: undefined | ((defaultModules: string[]) => string[]);
v2Addons: Map<string, string>;
rootPackage: Package;
}
Expand All @@ -32,6 +31,7 @@ export interface BuildResult {
// names (because users can also add more entrypoints to the webpack config)
entrypoints: Map<BundleName | string, string[]>;
lazyAssets: string[];
externalDepsFor(request: string): string[];
}

export type Bundler = Plugin & {
Expand Down
12 changes: 0 additions & 12 deletions packages/ember-auto-import/ts/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface Options {
alias?: { [fromName: string]: string };
webpack?: Configuration;
publicAssetURL?: string;
earlyBootSet?: (defaultModules: string[]) => string[];
styleLoaderOptions?: Record<string, unknown>;
cssLoaderOptions?: Record<string, unknown>;
miniCssExtractPluginOptions?: Record<string, unknown>;
Expand Down Expand Up @@ -414,17 +413,6 @@ export default class Package {
);
}

/**
* The function for defining the early boot set.
* Used when we begin building entry files for webpack, so that we can query all packages listed
* in the early boot set to check if they are v2 addons --if they are v2 addons,
* we remove them from the early boot set, as this feature is for a rare compatibility circumstance that
* only affects v1 addons consumed by v2 addons.
*/
get earlyBootSet(): undefined | ((defaults: string[]) => string[]) {
return this.isAddon ? undefined : this.autoImportOptions?.earlyBootSet;
}

get styleLoaderOptions(): Record<string, unknown> | undefined {
// only apps (not addons) are allowed to set this
return this.isAddon
Expand Down
1 change: 1 addition & 0 deletions packages/ember-auto-import/ts/tests/inserter-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Qmodule('inserter', function (hooks) {
buildResult = {
entrypoints: new Map(),
lazyAssets: [],
externalDepsFor: () => [],
};
bundleConfig = new BundleConfig({
app: {
Expand Down
Loading