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

require(...) is not a function #205

Closed
Scrum opened this issue Nov 30, 2020 · 0 comments
Closed

require(...) is not a function #205

Scrum opened this issue Nov 30, 2020 · 0 comments
Labels
type: bug Something isn't working
Milestone

Comments

@Scrum
Copy link
Owner

Scrum commented Nov 30, 2020

I've faced with a similar in AlexWayfer/flame-cli#57 (I'm trying to replace SCSS with PostCSS completely, so it's not quite this PR, but based on it).

> postcss assets/styles/ -d public/styles/ --base assets/styles/ --ext=css

TypeError: require(...) is not a function
    at Object.<anonymous> (/home/alex/Projects/ruby/test/foo_bar/postcss.config.js:3:40)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at module.exports (/home/alex/Projects/ruby/test/foo_bar/node_modules/.pnpm/import-fresh@3.2.2/node_modules/import-fresh/index.js:32:59)
    at loadJs (/home/alex/Projects/ruby/test/foo_bar/node_modules/.pnpm/cosmiconfig@7.0.0/node_modules/cosmiconfig/dist/loaders.js:16:18)
    at Explorer.loadFileContent (/home/alex/Projects/ruby/test/foo_bar/node_modules/.pnpm/cosmiconfig@7.0.0/node_modules/cosmiconfig/dist/Explorer.js:84:32)
    at Explorer.createCosmiconfigResult (/home/alex/Projects/ruby/test/foo_bar/node_modules/.pnpm/cosmiconfig@7.0.0/node_modules/cosmiconfig/dist/Explorer.js:89:36)

My configuration:

// postcss.config.js

module.exports = {
	plugins: [
		// there can be more, but it's reproducible only with this package
		require('postcss-at-rules-variables')({ atRules: ['media'] })
	]
}

package.json:

	"dependencies": {
		"@babel/core": "*",
		"@babel/plugin-transform-object-assign": "*",
		"@babel/preset-env": "*",
		"@rollup/plugin-babel": "*",
		"@rollup/plugin-commonjs": "*",
		"@rollup/plugin-json": "*",
		"@rollup/plugin-node-resolve": "*",
		"autoprefixer": "*",
		"postcss-at-rules-variables": "*",
		"postcss-cli": "*",
		"postcss-flexbugs-fixes": "*",
		"postcss-mixins": "*",
		"postcss-nested": "*",
		"promise-polyfill": "*",
		"rollup": "*",
		"sass": "*",
		"simplify-js": "*",
		"whatwg-fetch": "*"
	},
	...
	"scripts": {
		"build:styles": "postcss assets/styles/ -d public/styles/ --base assets/styles/ --ext=css",
		...
	}

With version lock like this:

"postcss-at-rules-variables": "^0.1.0",

there is no such error.

Originally posted by @AlexWayfer in #204 (comment)

@Scrum Scrum added this to the 0.2.1 milestone Nov 30, 2020
@Scrum Scrum added the type: bug Something isn't working label Nov 30, 2020
@Scrum Scrum closed this as completed in bdc8b2f Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant