简体   繁体   中英

Browserify cannot find module

I'm using browserify in my application and I've got some troubles on my build platform. I've got this file which references all my libs :

require('angular');
require('angular-aria');
require('angular-mocks');
require('angular-animate');
require('angular-notify');
require('angular-locale_fr');
require('ui-bootstrap');
require('angular-ui-router');
require('multiSelect');
require('moment');

I'm using grunt-browserify and I make two bundle : app.browserify.js and libs.browserify.js.

I've got this in my package.json :

  "browser": {
    "angular": "./Vendor/angular/angular.js",
    "angular-aria": "./Vendor/angular/angular-aria.js",
    "angular-filter": "./Vendor/angular/angular-filter.js",
    "angular-mocks": "./Vendor/angular/angular-mocks.js",
    "angular-animate": "./Vendor/angular/angular-animate.js",
    "angular-notify": "./Vendor/angular/angular-notify.js",
    "angular-locale_fr": "./Vendor/angular/angular-locale_fr.js",
    "ui-bootstrap": "./Vendor/angular/ui/ui-bootstrap.js",
    "angular-ui-router": "./Vendor/angular/ui/angular-ui-router.js",
    "moment": "./Vendor/moment/moment.js",
    "wdPagination": "./Vendor/pagination/wdPagination.js",
    "multiSelect": "./Vendor/multiselect/multiSelect.js"
  },

This work pretty well locally but on my build plateform file name libs.browserify.js is generate with this content :

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({},{},[]);

What's happenning? How can I see output logs of browserify?

Thanks.

I read my browserify config and find that I forgot tu use tsify to generate libs.browserify.js. Locally my files are automaticly compile so he find libs.js but on my build plateform there was no libs.js file.

confLIBS: {
    files: {
      "Scripts/Dist/libs.browserify.js": ["Scripts/App/libs.ts"]
    },
    //missing
    options: {
      plugin: [
        ['tsify', {
          "target": "es5",
          "module": "commonjs"
        }]
      ]
    }
  },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM