Comments (6)
Same thing when using the command line.
from webpack.
require('./bla')
.web.js
is the preferred extension for extension expansion. Specifying the complete filename do not try the .web.js
extension.
from webpack.
https://github.com/sokra/modules-webpack#browser-replacements
from webpack.
If you want to enforce .web.js
even for all .js
files, you can archive this by a resolve postprocessor:
resolve: {
postprocess: {
normal: [
function(filename, cb) {
var file = filename.split("!").pop();
if(!/\.js$/.test(file)) return callback(null, filename);
file = file.replace(/\.js$/, ".web.js");
fs.exists(file, function(exists) {
if(!exists) return callback(null, filename);
return callback(null, filename.replace(/\.js$/, ".web.js"));
});
}
]
}
}
from webpack.
Thanks, require('./bla')
did the trick. I should read the readme more attentively ;).
What exactly is a postprocessor in webpack? Is this ability documented?
from webpack.
Sorry, now I've read the next issue #7.
from webpack.
Related Issues (20)
- error:03000086:digital envelope routines::initialization error HOT 1
- Dynamic Imports that are marked external are hoisted HOT 6
- New case for "__webpack_modules__[moduleId] is not a function" error with Module Federation HOT 1
- Webpack 5 dealing with globals differently - Not found in changelog
- Eager consumption of a shared module if there are several versions of the module
- Code splitting single JS files based on which functions are used by which parent components or files. HOT 1
- PreOrderIndex and PostOrderIndex are incorrect in some cases
- Exported object names not minified since 5.79 HOT 2
- Empty file emitted for `await import('crypto')` in a dependency despite resolve.fallback.crypto = false
- Different window.open in an async call behaviour between Webpack 4 & Webpack 5 HOT 4
- Add null check to avoid `TypeError: Cannot read properties of undefined (reading 'call')` HOT 1
- this.importModule broken in esm packages HOT 7
- How does one dynamically import optional dependencies?
- Warning appeared after updating node version HOT 1
- Allow aliases to be resolved without an extra slash (#14370) HOT 2
- Cannot read properties of undefined (reading 'Z')
- Cannot read property 'name' of undefined HOT 1
- when setting `optimization.providedExports` to false, outputModule wouldn't generate export statement HOT 3
- Bundled code is attempting to export before importing (ERROR: _common__WEBPACK_IMPORTED_MODULE_1__ is undefined)
- Export warnings while exporting CSS using Webpack 5 HOT 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 webpack.