Webpack loader for ymodules module definitions
npm install ymodules-loader --save-dev
Add the following into your loader list:
module:loaders:test: /\.js$/loader: 'ymodules-loader'
exclude: /node_modules/ if you don't need to look for that modules among vendor components
Then loader will pass through your
js-files and detect all imports in
ymodules format. All found
dependencies would be added with
var modules = ;;;modules;
After that webpack will find all your modules and put them together as well as usual CommonJS modules.
See the test folder for real usage example.
The code processing is performed by babel.
Now we are assuming that your modules placed by default bem-project structure like:
common.blocks/├── button│ └── button.js├── input│ └── input.js└── select└── select.js
In future versions module path resolving will be configurable.