Giter VIP home page Giter VIP logo

rollup-plugin-import-assertions's People

Contributors

cmcculloh avatar swiing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

cmcculloh

rollup-plugin-import-assertions's Issues

Node deprecation warning

When running with node 18, this deprecation warning is generated:

(node:17848) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at PROJECT_FOLDER\node_modules\.pnpm\[email protected]\node_modules\acorn-import-assertions\package.json imported from PROJECT_FOLDER\node_modules\.pnpm\[email protected]\node_modules\rollup-plugin-import-assertions\dist\index.js.
Update this package.json to use a subpath pattern like "./*".

Getting error [!] (plugin import-assertions) TypeError: self.load is not a function

Installing rollup cli and executing rollup -c rollup.config.js works without any errors but when I run this using npm run build then I get following error:

╰─ npm run build                                                                                                                                                 ─╯ 

> [email protected] build
> rimraf dist && rollup -c rollup.config.js


./index.html → dist...
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
(node:21616) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\khash\Developme
nt\gramps-project\Gramps.js\node_modules\tslib\package.json.                                                                                                        Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
[!] (plugin import-assertions) TypeError: self.load is not a function
src\lang\index.js
TypeError: self.load is not a function
    at C:\Users\khash\Development\gramps-project\Gramps.js\node_modules\rollup-plugin-import-assertions\src\index.js:143:16
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at Object.transform (C:\Users\khash\Development\gramps-project\Gramps.js\node_modules\rollup-plugin-import-assertions\src\index.js:126:7)
    at ModuleLoader.addModuleSource (C:\Users\khash\Development\gramps-project\Gramps.js\node_modules\rollup\dist\shared\rollup.js:19708:30)
    at ModuleLoader.fetchModule (C:\Users\khash\Development\gramps-project\Gramps.js\node_modules\rollup\dist\shared\rollup.js:19761:9)
    at async Promise.all (index 0)
    at ModuleLoader.fetchStaticDependencies (C:\Users\khash\Development\gramps-project\Gramps.js\node_modules\rollup\dist\shared\rollup.js:19792:34)
    at async Promise.all (index 0)


My package.json build command:

  "scripts": {
    "lint:eslint": "eslint --ext .js,.html . --ignore-path .gitignore",
    "format:eslint": "eslint --ext .js,.html . --fix --ignore-path .gitignore",
    "lint:prettier": "prettier \"**/*.js\" --check --ignore-path .gitignore",
    "format:prettier": "prettier \"**/*.js\" --write --ignore-path .gitignore",
    "lint": "npm run lint:eslint && npm run lint:prettier",
    "format": "npm run format:eslint && npm run format:prettier",
    "build": "rollup -c rollup.config.js",
    "start": "web-dev-server --app-index index.html --node-resolve --open --watch"
  }

And here is my rollup.config.js

import merge from 'deepmerge'
import copy from 'rollup-plugin-copy'
import { createSpaConfig } from '@open-wc/building-rollup'
import importAssertions from 'rollup-plugin-import-assertions'
import replace from '@rollup/plugin-replace'

const API_URL = (process.env.API_URL === undefined)
  ? ''
  : process.env.API_URL

const BASE_DIR = (process.env.BASE_DIR === undefined)
  ? ''
  : process.env.BASE_DIR

const baseConfig = createSpaConfig({
  developmentMode: process.env.ROLLUP_WATCH === 'true',
  injectServiceWorker: true,
  workbox: {
    navigateFallbackDenylist: [/^\/api.*/],
    skipWaiting: false,
    clientsClaim: false
  },
  html: {
    transform: [
      (html) =>
        html.replace(
          '<base href="/">',
          `<base href="${BASE_DIR}/">`
        )
    ]
  }
})

export default merge(baseConfig, {
  input: './index.html',
  plugins: [
    copy({
      targets: [
        { src: './leaflet.css', dest: 'dist/' },
        { src: './manifest.json', dest: 'dist/' },
        { src: './images/**/*', dest: 'dist/images' },
        {
          src: 'node_modules/@hpcc-js/wasm/dist/graphvizlib.wasm',
          dest: 'dist/'
        },
        {
          src: 'node_modules/@hpcc-js/wasm/dist/graphvizlib.wasm',
          dest: 'dist/@hpcc-js/wasm'
        },
        {
          src: 'node_modules/@hpcc-js/wasm/dist/index.min.js',
          dest: 'dist/@hpcc-js/wasm'
        }
      ]
    }),
    replace({
      'http://localhost:5555': API_URL,
      BASE_DIR: JSON.stringify(BASE_DIR),
      preventAssignment: true
    }),
    importAssertions()
  ]
})

Add option to remove comments when parsing CSS files as CSSStyleSheet

I'm using rollup-plugin-import-assertions to parse CSS files as CSSStyleSheet, but I noticed that comments in the CSS files are included as strings in the resulting CSSStyleSheet object. However, even with terser, the resulting files still contain the comments.This increases the file size.

It would be great if there was an option to remove comments when parsing CSS files as CSSStyleSheet. This would make the resulting CSSStyleSheet object smaller.

Is it possible to add such an option to rollup-plugin-import-assertions?

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.