Reputation: 2850
I am using rollup
to bundle my project.
At the start, everything was working fine, but I do not know what I changed in my config, I started getting this error on running rollup -c
.
[!] Error: "version" is a required argument.
Error: "version" is a required argument.
at Object.getArg (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:14625:11)
at SourceMapConsumer$1.BasicSourceMapConsumer (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:15763:22)
at new SourceMapConsumer$1 (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:15491:7)
at Module.getOriginalLocation (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:16925:16)
at Module.error (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:16942:26)
at CallExpression.bindNode (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:12326:17)
at CallExpression.bind (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:11415:8)
at eachChild.child (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:11433:34)
at keys.forEach.key (/home/programmersedge/.nvm/versions/node/v6.11.1/lib/node_modules/rollup/dist/rollup.js:11450:5)
at Array.forEach (native)
Here is my rollup.config.js
import resolve from 'rollup-plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import filesize from 'rollup-plugin-filesize'
import typescript from 'rollup-plugin-typescript2'
import commonjs from 'rollup-plugin-commonjs'
import postcss from 'rollup-plugin-postcss-modules'
import autoprefixer from 'autoprefixer'
import sass from "node-sass"
const preprocessor = (content, id) => new Promise((resolve, reject) => {
sass.render({
file: id,
sourceMap: "string",
sourceComments: true,
sourceMapContents: true,
outputStyle: "compressed"
},(err, result) => {
if (err) {
return reject(err);
}
resolve({code: result.css.toString()});
});
});
export default {
input: 'src/index.ts',
output: {
file: 'lib/index.js',
format: 'umd',
globals: {
...
},
sourcemap: true,
},
external: [
...
],
plugins: [
resolve(),
postcss({
preprocessor,
plugins: [
autoprefixer(),
],
extensions: ['.scss'],
writeDefinitions: true,
postcssModulesOptions: {
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}),
typescript({
tsconfigOverride: {
compilerOptions: {
declaration: true,
moduleResolution: "node"
}
},
rollupCommonJSResolveHack: true,
abortOnError: false,
typescript: require('typescript'),
}),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
filesize()
],
watch: {
include: 'src/**'
}
};
I am not able to figure out where the version
argument should go in my setup
or
what's wrong with my setup. Can anyone help me out here?
Upvotes: 0
Views: 2607
Reputation: 10607
For anyone who encounters this, there is now a PR open with a fix:
https://github.com/rollup/rollup/pull/2012
Also, for many people once this is fixed, it will reveal the real issue: Cannot call a namespace.
I found a fix for that in its own Rollup issue (happens with TypeScript):
import * as something_ from 'something';
const something: typeof something_ = something;
// Now you can use `soemthing` as usual
This only happens when using TypeScript through Rollup, not when running tsc
directly.
Upvotes: 1
Reputation: 2850
Anyways I fixed the issue.
Here the explanation for the issue
The reported error is an error that occurs when trying to use a source map when reporting another error. The actual error that occurs is probably CANNOT_CALL_NAMESPACE, which from my understanding means that you're trying to call a variable to which you bound * in an import.
and Here's the GitHub Issue you can refer to.
Upvotes: 1