Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
Next.js create a polyfill.js file in dist folder

I try to implement the Trading view library's next.js example. In _document.js file I have to import

<script src="/static/datafeeds/udf/dist/polyfills.js" />
<script src="/static/datafeeds/udf/dist/bundle.js" />

But when I go to datafeeds/udf.dist folder only I can see is the bundle.js file. And inside the udf folder I have this package.json file

{
  "private": true,
  "dependencies": {
    "tslib": "2.1.0"
  },
  "devDependencies": {
    "@rollup/plugin-node-resolve": "~9.0.0",
    "rollup": "~2.28.2",
    "rollup-plugin-terser": "~7.0.2",
    "typescript": "4.2.3"
  },
  "scripts": {
    "compile": "tsc",
    "bundle-js": "rollup -c rollup.config.js",
    "build": "npm run compile && npm run bundle-js"
  }
}

and rollup.config.js

/* globals process */

import { terser } from 'rollup-plugin-terser';
import { nodeResolve } from '@rollup/plugin-node-resolve';

const environment = process.env.ENV || 'development';
const isDevelopmentEnv = (environment === 'development');

export default [
    {
        input: 'lib/udf-compatible-datafeed.js',
        output: {
            name: 'Datafeeds',
            format: 'umd',
            file: 'dist/bundle.js',
        },
        plugins: [
            nodeResolve(),
            !isDevelopmentEnv && terser({
                ecma: 2017,
                safari10: true,
                output: { inline_script: true },
            }),
        ],
    },
];

When I run compile,bundle-js, and build scripts that only create the bundle.js file only. How can I create a polyfills.js file inside the dist folder? I hope this can be done with rollup pakcage.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!