-
-
Notifications
You must be signed in to change notification settings - Fork 622
Closed
Labels
Description
- Rollup Version: 2.40.0
- Operating System (or Browser): macOS 11.2
- Node Version (if applicable): 14.15.5
- Link to reproduction (IMPORTANT, read below): https://github.com/mlbonniec/MMM-NiceHash/tree/9dcd674b9e3192165bb156b7fa9dc14e6a2587d2
Expected Behavior
Hi, I'm trying to compile my TypeScript files into JS, but the problem is that nodeResolve doesn't seem to work properly. For example, when I use axios, in my build, axios is not defined, yet at the beginning of my file it says "require('axios')". Yet it is "undefined" in all my file. Do you have an idea of the problem?
Actual Behavior
The compiled files use dependencies that are "undefined". However, no errors during compilation.
Here's my actual rollup.config.js file.
import typescript from '@rollup/plugin-typescript';
import commonJS from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { dependencies } from './package.json';
const deps = Object.keys(dependencies);
export default [
{
input: './src/MMM-NiceHash.ts',
plugins: [
nodeResolve(),
typescript(),
commonJS(),
],
external: [...deps],
output: {
file: './MMM-NiceHash.js',
format: 'umd',
globals: {
axios: 'axios',
uuid: 'uuid',
},
},
},
{
input: './src/node_helper.ts',
plugins: [
nodeResolve(),
typescript(),
commonJS(),
],
external: ['node_helper', 'crypto', ...deps],
output: {
file: './node_helper.js',
format: 'umd',
globals: {
axios: 'axios',
uuid: 'uuid',
crypto: 'crypto',
},
},
},
];Reactions are currently unavailable