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

feat: allow importing css from node_modules #254

Merged
merged 1 commit into from
Aug 24, 2021
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
3 changes: 2 additions & 1 deletion fixtures/gists-app/app/root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { useEffect } from "react";
import { Links, Meta, Scripts, useRouteData, useMatches } from "remix";
import { Outlet, Link } from "react-router-dom";

import normalizeHref from "@exampledev/new.css/new.css";
import stylesHref from "./styles/app.css";

export function links() {
return [
{
rel: "stylesheet",
href: "https://unpkg.com/@exampledev/new.css@1.1.3/new.css"
href: normalizeHref
},
{ rel: "stylesheet", href: stylesHref }
];
Expand Down
1 change: 1 addition & 0 deletions fixtures/gists-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"start": "node server.js"
},
"dependencies": {
"@exampledev/new.css": "^1.1.3",
"@mdx-js/react": "^1.6.22",
"autoprefixer": "^10.2.4",
"compression": "^1.7.4",
Expand Down
4 changes: 4 additions & 0 deletions packages/remix-dev/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ async function createServerBuild(
packageName
);
}

// allow importing css files for bundling / hashing from node_modules.
if (id.endsWith(".css")) return false;
jacob-ebey marked this conversation as resolved.
Show resolved Hide resolved

return true;
}

Expand Down
1 change: 1 addition & 0 deletions packages/remix-dev/compiler/plugins/mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function mdxPlugin(config: RemixConfig): esbuild.Plugin {
export const filename = ${JSON.stringify(path.basename(args.path))};
export const headers = typeof attributes !== "undefined" && attributes.headers;
export const meta = typeof attributes !== "undefined" && attributes.meta;
export const links = undefined;
mjackson marked this conversation as resolved.
Show resolved Hide resolved
`;

let errors: esbuild.PartialMessage[] = [];
Expand Down