Comments (4)
supporting all placeholders by
TemplatePathPlugin
is not a realistic approach in my opinion.
I agree! (there are some other libraries that will do the templating for you, e.g. https://github.com/webpack/webpack/blob/master/lib/TemplatedPathPlugin.js) but you probably don't want to reply on other libs)
So we need to think about some workaround or another way.
I guess your expectation will be fulfilled by providing another placeholder for "Output filename" right?
Well, possibly, although I actually am producing 2 output files, and I want to cut the hash out of both, so it might be a bit more complicated. I actually have solved my problem by, instead of using a symlink, using the FileManagerPlugin
plugin which can do a copy with [hash]
templated filenames, so there's no urgency for me to get this into SymlinkWebpackPlugin
, but it would be preferable.
Thanks!
from symlink-webpack-plugin.
It seems like you can access the hash using the webpack.ExtendedAPIPlugin
, which creates a global variable __webpack_hash__
, but I can't get this to work as I expect. E.g. I was hoping to do something like this:
plugins: [
new webpack.ExtendedAPIPlugin(),
new SymlinkWebpackPlugin({ origin: 'entry.' + __webpack_hash__ + '.js', symlink: 'entry.js' }),
But I get >> ReferenceError: _webpack_hash_ is not defined
. It there any easy way to access this from within the SymlinkWebpackPlugin config object?
from symlink-webpack-plugin.
Thanks for your effort to find out the way to make that happens :)
[name]
, [hash]
are actually resolved by TemplatePathPlugin
on compilation
, assetPath
hook.
But SymlinkWebpackPlugin
works among the emitted outputs where all pathnames are resolved. And supporting all placeholders by TemplatePathPlugin
is not a realistic approach in my opinion.
So we need to think about some workaround or another way.
I guess your expectation will be fulfilled by providing another placeholder for "Output filename" right?
I'm wondering if we can write the config as:
{ origin: '[output]', symlink: 'entry.js' }
Probably this makes that [name].[hash].js
is linked from entry.js
.
Does this work for you? If so, I may work on supporting that π€
from symlink-webpack-plugin.
Good point. Need more considerations to support multiple outputs π€
FileManagerPlugin
seems to provide appropriate features with RegexGlob and [hash]
. Let me look into this weekend. Thanks for your input!
from symlink-webpack-plugin.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symlink-webpack-plugin.