goto-bus-stop / flat-loader Goto Github PK
View Code? Open in Web Editor NEWScope hoisting Webpack loader based on Rollup. — use webpack 3's ModuleConcatenationPlugin instead!
Home Page: https://npmjs.com/package/flat-loader
License: MIT License
Scope hoisting Webpack loader based on Rollup. — use webpack 3's ModuleConcatenationPlugin instead!
Home Page: https://npmjs.com/package/flat-loader
License: MIT License
I was not able to use it with jsx files.
Doing this at the moment:
https://github.com/goto-bus-stop/flat-loader/blob/master/webpack-plugin.js#L9-L24
But it may not be necessary.
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.
How to reproduce:
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, '/')}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.