Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

* Convert to Polymer 3

Recognize tagged template literal expressions and process them as HTML templates.

* 3.0.0-0

* Fix up basic tests

* Update the demo

* Disable the removeAttributeQuotes option for the html-loader by default

* Update node versions to require a minimum of Node 8

* Refactor code to be reusable

* Add support for style urls

* Update readme for Polymer 3

* Add tests to increase coverage

* 3.0.0-1

* Use a text node rather than assigning to innerText

* 3.0.0-2

* Update test snapshots

* feat: add source map support

* 3.0.0-3

* fix: adjust column offset logic

* 3.0.0-4

* Update travis config now that the yarn.lock file is deleted
b7dbd15

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

polymer-webpack-loader

npm version build status

Polymer component loader for webpack.

The loader processes Polymer 3 template elements to minify the html and add images, fonts and imported stylesheets to the webpack dependency graph.

Looking for the Polymer 2 version? See the Polymer 2 branch

Configuring the Loader

{
  test: /\.js$/,
  options: {
    htmlLoader: Object (optional)
  },
  loader: 'polymer-webpack-loader'
},

Options

htmlLoader: Object

Options to pass to the html-loader. See html-loader.

Use with Babel (or other JS transpilers)

If you'd like to transpile the contents of your element you can chain an additional loader.

module: {
  loaders: [
    {
      test: /\.html$/,
      use: [
        // Chained loaders are applied last to first
        { loader: 'babel-loader' },
        { loader: 'polymer-webpack-loader' }
      ]
    }
  ]
}

// alternative syntax

module: {
  loaders: [
    {
      test: /\.html$/,
      // Chained loaders are applied right to left
      loader: 'babel-loader!polymer-webpack-loader'
    }
  ]
}

Boostrapping Your Application

The webcomponent polyfills must be added in a specific order. If you do not delay loading the main bundle with your components, you will see the following exceptions in the browser console:

Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

Reference the demo html file for the proper loading sequence.

Maintainers


Bryan Coulter

Chad Killingsworth

Rob Dodson