ultraq / thymeleafjs

A basic implementation of the Thymeleaf templating engine in JavaScript
Apache License 2.0
52 stars 8 forks source link

Bundling causes it to try bring in fs, jsdom #12

Closed ultraq closed 6 years ago

ultraq commented 6 years ago

When used as a dependency and then bundled w/ Webpack (and probably Rollup), the bundler tries to rope in fs and jsdom. Since the bundle is for a browser, these dependencies are invalid.

The mocks in the browser directory only seem to help with creating a browser distro, but not when used as a dependency via npm and then bundled for a browser distro.

As such, I might need to rethink how to use those dependencies.

As a workaround for Webpack, use the IgnorePlugin:

plugins: [
  new webpack.IgnorePlugin(
    /(fs|jsdom)/,
    /thymeleaf/
  )
]

I'm sure it's roughly the same workaround with Rollup and rollup-plugin-ignore.

ultraq commented 6 years ago

Some useful resources: