rollupjs

How to set up rollup.js with a d3 plugin?

我的未来我决定 提交于 2021-02-11 13:38:25
问题 I currently write a d3 plugin. However, I want to call this plugin as property of the global d3 as in the original example: d3.foo() But when I do this, my configurations for rollup lead to a clash of the d3 references. Here is one minimal example (with just one file) to illustrate: I downloaded the original example of the d3 plugin and slightly changed the source file foo.js: //.src/foo.js import * as d3 from "d3"; export default function() { return d3.select("body").append("div").text(42);

Function.prototype.toString issues in IE11 Svelte/Babel/Rollup

回眸只為那壹抹淺笑 提交于 2021-02-08 07:22:00
问题 My current rollup.config.js is commonjs(), babel({ extensions: ['.js', '.mjs', '.html', '.svelte'], runtimeHelpers: true, exclude: ['node_modules/@babel/**', 'node_modules/core-js/**' ], // <= /!\ NOT 'node_mobules/**' presets: [ ['@babel/preset-env', { // adapter to ensure IE 11 support targets: '> 0.25%, not dead, IE 11', "modules": false, "spec": true, "forceAllTransforms": true, useBuiltIns: 'usage', corejs: 3 }] ], plugins: [ '@babel/plugin-syntax-dynamic-import', [ '@babel/plugin

Function.prototype.toString issues in IE11 Svelte/Babel/Rollup

你离开我真会死。 提交于 2021-02-08 07:19:37
问题 My current rollup.config.js is commonjs(), babel({ extensions: ['.js', '.mjs', '.html', '.svelte'], runtimeHelpers: true, exclude: ['node_modules/@babel/**', 'node_modules/core-js/**' ], // <= /!\ NOT 'node_mobules/**' presets: [ ['@babel/preset-env', { // adapter to ensure IE 11 support targets: '> 0.25%, not dead, IE 11', "modules": false, "spec": true, "forceAllTransforms": true, useBuiltIns: 'usage', corejs: 3 }] ], plugins: [ '@babel/plugin-syntax-dynamic-import', [ '@babel/plugin

How to integrate Material UI into Svelte project

佐手、 提交于 2021-02-07 08:13:54
问题 I want to integrate Material UI into my Svelte project. I tried to follow the official documentation from here, but I don't know why I'm getting a strange error while trying to run my project: loaded rollup.config.js with warnings (!) Unused external imports default imported from external module 'rollup-plugin-postcss' but never used rollup v1.27.13 bundles src/main.js → public/build/bundle.js... [!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)

How to integrate Material UI into Svelte project

北城余情 提交于 2021-02-07 08:10:23
问题 I want to integrate Material UI into my Svelte project. I tried to follow the official documentation from here, but I don't know why I'm getting a strange error while trying to run my project: loaded rollup.config.js with warnings (!) Unused external imports default imported from external module 'rollup-plugin-postcss' but never used rollup v1.27.13 bundles src/main.js → public/build/bundle.js... [!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)

Creating a standalone web component build using as an IIFE

房东的猫 提交于 2021-01-29 11:26:44
问题 I have create a web component for displaying gists generally in any html content. I used the Lit Element Typescript Starter Project as a baseline and it comes with a rollup.config.js file. I changed the output format to iife and left the rest the same, with exception of the component and bundle names. The reason I did this is that I wanted the bundle to be easily accessible via script tags, and rollup says that the iife format does this. This is the modified rollup.config.js file. // ========

Using rollup in combination with babel and commonjs plugins doesn't resolve all modules

末鹿安然 提交于 2021-01-27 17:18:32
问题 I'm using rollup with the Babel and CommonJS plugins, like this: const inputOptions = { input: "...", plugins: [ resolve(), babel({ exclude: "node_modules/**", externalHelpers: true, include: "**/components/**/*.js", }), commonjs(), ], }; But what happens is that modules referenced from components don't seem to be recognized by the CommonJS plugin, they end up as plain require(...) statements in the output (just like the source input) where of course they cannot be resolved. Modules imported

Output Single HTML File from Svelte Project

梦想的初衷 提交于 2021-01-27 14:52:38
问题 I can't find any example anywhere online that shows how to (or if we can) output a single HTML file from a Svelte project using Rollup (not Webpack), containing all CSS and JS injected inline (and not as URLs in script). 回答1: There is no built-in way to achieve this, so you'll have to write your own plugin to do so. This code is some sort of an attemt to get this done and could act as a starter point. It is in no way actually complete or good. (to be honest I doubt you will be winning any

Output Single HTML File from Svelte Project

隐身守侯 提交于 2021-01-27 14:41:22
问题 I can't find any example anywhere online that shows how to (or if we can) output a single HTML file from a Svelte project using Rollup (not Webpack), containing all CSS and JS injected inline (and not as URLs in script). 回答1: There is no built-in way to achieve this, so you'll have to write your own plugin to do so. This code is some sort of an attemt to get this done and could act as a starter point. It is in no way actually complete or good. (to be honest I doubt you will be winning any

Is there any way to preserve directory structure of bundles when using rollup with code splitting?

浪子不回头ぞ 提交于 2021-01-27 07:52:18
问题 Context: Given a project structure like this: ┌ src ├─┬ a │ └── module.js ├─┬ b │ └── module.js └── util.js Where both module.js files import util.js , using the following configuration: export default { experimentalCodeSplitting: true, input: [ 'src/a/module.js', 'src/b/module.js' ], output: { dir: 'bundle', format: 'esm' } }; The following structure is output: ┌ bundle ├── chunk-af6d88c4.js ├── module.js └── module2.js Problem: When using code splitting to reduce redundant code across a