lusini / mapify Goto Github PK
View Code? Open in Web Editor NEWAlias mappings for browserify
Alias mappings for browserify
This works:
require('alias/index')
This does not:
require('alias/')
Expected behavior is that require('alias/')
would be equivalent to require('alias/index')
I have multiple bundle targets in my project. How can I use mapify in this case? The examples in the README assume a project with only one bundle.
My project structure is:
project->
src->
target1/index.js
target2/index.js
I want the src directory to be the root for require('src/*')
calls. I tried:
browserify(__dirname+'/src/'+targetName)
.plugin('mapify', {
cwd: '../',
pattern: '**/*.js',
expose: 'src'
})
.bundle()
But that didn't work...
Hey, neat little plugin you've got. I noticed on Windows the aliases are being resolved with \
seperators, which means that require('../../../some/path')
becomes require('some\\path')
. This also makes the tests fail on Windows.
I didn't include a pull request because I'm not sure what the best way to solve this is. It's technically correct to use the Windows seperators...but a bit confusing when the aliases use different seperators than the programmer. However, a global replace on the seperators to force /
doesn't sound too great either. I thought maybe I could parse out the seperator in the unaliased path, but I couldn't think of a way to do that without allowing false positives from the filename (some\ file.txt
for example; note the escaped space, which I think is valid on *nix systems). Any thoughts?
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.