Giter Site home page Giter Site logo

goto-bus-stop / flat-loader Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 32 KB

Scope hoisting Webpack loader based on Rollup. — use webpack 3's ModuleConcatenationPlugin instead!

Home Page: https://npmjs.com/package/flat-loader

License: MIT License

JavaScript 98.73% CSS 1.27%
bundler bundling modules rollup webpack webpack-loader

flat-loader's People

Contributors

goto-bus-stop avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

flat-loader's Issues

Make it work well with chunks

eg. given this:

// app.js
import './something'

import('./other-chunk').then(() => {})
// other-chunk.js
import './whatever'

both app.js and other-chunk.js could be rollup-ed.

"Module not found" on Windows when importing not from context dir

How to reproduce:

  1. PC or VM with Windows
  2. unzip example.zip
  3. npm install
  4. npm start

ERROR in ./src/app.js
Module not found: Error: Can't resolve './stylesstyle.css' in 'c:\work\example\src'
@ ./src/app.js 2:0-39
@ multi (webpack)-dev-server/client?http://localhost:8080 ./app.js

What happens:
Substitution of external module at https://github.com/goto-bus-stop/flat-loader/blob/master/webpack-plugin.js#L86 uses relative path which, in case of Windows, results into import "./style\styles.css" emitted into output. Backslash(es) then get interpreted as escape characters, not as path separators.

Proposed fix:
Backslashes should be replaced with '/'.
In the webpack-plugin.js, replace

return ${EXTERNAL_IDENTIFIER}./${relative.replace(/\.js$/, '')}

with

return ${EXTERNAL_IDENTIFIER}./${relative.replace(/\.js$/, '').replace(/\\/g, '/')}

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.