Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

120
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda