Giter VIP home page Giter VIP logo

vulcanize-loader's People

Contributors

aitoroses avatar caleblloyd avatar knewter avatar mkazlauskas avatar rcausey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vulcanize-loader's Issues

SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'

Hi,

When I run this in my main.js (set entry in webpack.config.js):

require("vulcanize?compress=true&base=/dist!./components/home/polymer-home.html");

I get:

{ [Error: Error parsing script in /home/vedtam/testing/polymer-apollo/polymer/components/home/polymer-home.html at 31:1
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'
    at Parser.instance.raise.instance.raiseRecoverable (/home/vedtam/testing/polymer-apollo/polymer/node_modules/espree/espree.js:408:19)
    at Parser.pp$1.parseStatement (/home/vedtam/testing/polymer-apollo/polymer/node_modules/espree/node_modules/acorn/dist/acorn.js:752:16)
    at Parser.pp$1.parseTopLevel (/home/vedtam/testing/polymer-apollo/polymer/node_modules/espree/node_modules/acorn/dist/acorn.js:658:25)
    at Parser.parseTopLevel (/home/vedtam/testing/polymer-apollo/polymer/node_modules/espree/espree.js:270:34)
    at Parser.parse (/home/vedtam/testing/polymer-apollo/polymer/node_modules/espree/node_modules/acorn/dist/acorn.js:528:17)
    at Object.parse (/home/vedtam/testing/polymer-apollo/polymer/node_modules/espree/node_modules/acorn/dist/acorn.js:3309:39)
    at Object.parse (/home/vedtam/testing/polymer-apollo/polymer/node_modules/espree/espree.js:735:21)
    at Object.jsParse (/home/vedtam/testing/polymer-apollo/polymer/node_modules/hydrolysis/lib/ast-utils/js-parse.js:63:25)
    at Analyzer._processScript (/home/vedtam/testing/polymer-apollo/polymer/node_modules/hydrolysis/lib/analyzer.js:318:43)
    at /home/vedtam/testing/polymer-apollo/polymer/node_modules/hydrolysis/lib/analyzer.js:301:44]
  location: { line: 31, column: 1 },
  ownerDocument: '/home/vedtam/testing/polymer-apollo/polymer/components/home/polymer-home.html' }
[TypeError: Can't extract the value of a Nothing.]

At line 31 in my polymer-home.js I have:

import ApolloClient, { createNetworkInterface, addTypename } from 'apollo-client';
import { PolymerApollo } from 'polymer-apollo';
import gql from 'graphql-tag';

Doesn't seem to work with hot module replacement for imports

The problem

When using this in the polymer branch's style, and dealing with styles, you have to refresh the entire webpack server in order to see any changes take place :(

Towards a solution?

I've forked the polymer example and made a slight modification to show what I'm trying to do:

https://github.com/knewter/elm-webpack-starter/tree/polymer_hot

If you run that, there's a theme file that makes the background red. For ideal style development, it would be nice if hot module replacement were supported (even for 'imported' files), so that when you changed the theme file the browser updated accordingly.

I made the loader sort of kind of try to work with hot module replacement. I have no idea what remains to be done or if this is stupid, and I did it against the transpiled code, but you can find it here: https://github.com/knewter/elm-webpack-starter/blob/polymer_hot/loader.js#L359-L381

I'm not sure what could be done to make this work but at present working on a project that uses this is pretty unfortunate when dealing with styling because the feedback loop requires me to restart the webpack server every single time to take the changes :( (though technically I can explicitly change the actual webpack required file and then refresh - still breaks HMR)

I was wondering if you wanted to pair to see what or if we could work through it. Otherwise, I'll look at it later I'm sure. Just wanted to write this up while it was fresh on my mind. Thanks for the software!

How to use it in a webpack configuration ?

Hello,
Can you give an example of using this loader in a webpack configuration ?
In which file include the require ? How to import the html from a bower_components directory ?
Thanks in advance.
Regards

Webpack output.publicPath Config not respected

This library presently does not respect the webpack global output.publicPath configuration

This currently causes the vulcanized HTML import to always point to /imports.html, even if output.publicPath='/assets/', meaning the vulcanized HTML import should actually point to /assets/imports.html

It also causes issues if <base> is used, for example <base href="/assets/">. In this case, the publicPath should be output.publicPath='' and the link to the vulcanized HTML import should be imports.html. Presently it forces a leading slash by outputting /imports.html, breaking the assumptions of <base>

No hash in the emitted files

I'm not getting hashes in the files emitted by the plugin:

screen shot 2017-05-02 at 19 29 58

I even wonder why am I getting web-components.js file emitted at all. It should be part of the app chunk. Right?

This is how my entry looks like:

entry: 
   { app: 
      [ 'blueimp-canvas-to-blob',
        './scripts/main.ts',
        './styles/main.scss',
        '../bower_components/webcomponentsjs/webcomponents-lite',
        '../web-components.html' ],
     somethingElse: [ './something-else/something-else.ts', './something-else/something-else.scss' ] },

Output HTML not minified

The resulting HTML contains a lot of HTML comments as well as unminified CSS. I can't get it to run through the html-loader to fix it. Possibly the solution is to run the resulting HTML through https://github.com/PolymerLabs/polyclean as well as vulcanize. Another interesting solution would be use the new https://github.com/Polymer/polymer-build since it contains all the polymer build tools: vulcanize, crisper and polyclean.

A pure webpack solution using html-loader would also be an interesting idea.

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.