Skip to content

Fails in docker but works outside docker #99

Description

@Boscop

Hi, thanks for this great plugin :)
It works great for me, but unfortunately only outside docker:
My docker image for my web app builds fine when my frontend doesn't import any scss file, but it needs a single scss file (index.scss), and when the frontend imports it, yarn build fails with this error:

#29 469.0 [!] RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)
#29 469.0 ../../index.scss (1:5)
#29 469.0 1: html {
#29 469.0 ^

In the Dockerfile I'm doing yarn install before yarn build and I have "rollup-plugin-scss": "^3.0.0", in my devDependencies, so it should work, right?
Here I posted my Dockerfile, package.json and rollup.config.mjs file for context: https://gist.github.com/Boscop/67fe407a634ee6dcf9f55abfe4328f45
E.g. this is the rollup.config.mjs file:

import rust from "@wasm-tool/rollup-plugin-rust";
import livereload from "rollup-plugin-livereload";
import { terser } from "rollup-plugin-terser";
import copy from "rollup-plugin-copy";
import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import scss from "rollup-plugin-scss"
import dev from "rollup-plugin-dev"
import nodePolyfills from "rollup-plugin-polyfill-node";

const is_watch = !!process.env.ROLLUP_WATCH;

export default {
	input: {
		index: "Cargo.toml",
	},
	output: {
		dir: "dist/js", 
		format: "iife",
		sourcemap: true,
	},
	plugins: [
		nodeResolve(),
		is_watch && dev({
			dirs: ["dist"],
			host: "0.0.0.0", 
			port: 8080,
			proxy: [
				{ from: "/api", to: "http://localhost:9000/api" },
			],
		}),
		scss({
			output: "dist/bundle.css",
			verbose: true,
			failOnError: true,
		}),
		rust({
			serverPath: "js/", 
		}),
		commonjs(),
		nodePolyfills(),
		copy({
			targets: [
				{ src: "index.html", dest: "dist" },
				{ src: "favicon.png", dest: "dist" },
			]
		}),
		is_watch && livereload("dist"),
		!is_watch && terser(),
	],
};

Btw, outside of docker (on Windows 10), yarn build works fine, even when my project imports the scss file!
So I'm wondering, why is it only failing inside docker?

It seems I'm stuck with this, so I'd really appreciate any hint for how to solve this :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions